পৃষ্ঠাসমূহ

মঙ্গলবার, ১৫ ডিসেম্বর, ২০১৫

URI Online Judge | 1235 Inside Out Solution

[sourcecode language="c"]


/*****************************
* Author: Md. Rana Mahmud *
* r4n4m4hmud.wordpress.com *
*****************************/

#include <iostream>

using namespace std;

int main()
{


int n;
cin>>n;
cin.ignore();
string line;
while(n-->0)
{
getline(cin,line);

for(int i = (line.length()/2)-1; i>=0; i--)
cout<<line[i];

for(int i = line.length()-1; i>=line.length()/2; i--)
cout<<line[i];
cout<<endl;




}

}

[/sourcecode]

URI Online Judge | 1218 Getline Three - Shoes Solution

[sourcecode language="c"]

/*****************************
* Author: Md. Rana Mahmud *
* r4n4m4hmud.wordpress.com *
*****************************/

#include <iostream>
#include <cstdio>
#include <sstream>
using namespace std;

int main()
{


int N,number,mShoes,fShoes,totalShoes,counter = 1,mark = 0;
string line,str;
char ch;

while(scanf("%d",&N)!=EOF)
{
mShoes = 0;
fShoes = 0;
cin.ignore();
getline(cin,line);
stringstream ss(line);

while(ss>>number>>ch)
{
if(number==N)
{
if(ch=='M')
mShoes++;
else if(ch=='F')
fShoes++;
}
}
if(mark!=0)
cout<<endl;
else
mark = 1;
printf("Caso %d:\n",counter);
counter++;
totalShoes = mShoes+fShoes;
printf("Pares Iguais: %d\n",totalShoes);
printf("F: %d\n",fShoes);
printf("M: %d\n",mShoes);


}

}


[/sourcecode]

URI Online Judge | 1217 Getline Two - Fruits Solution

[sourcecode language="c"]
#include <iostream>
#include <string>
#include <sstream>
#include <cstdio>
using namespace std;

int main()
{
int n;
cin>>n;
int day[n],kgCount,kg[n];
double cost, kgSum= 0,moneySum = 0;

string line,str;
for(int i = 0; i<n; i++)
{
kgCount = 0;
cin>>cost;
moneySum+=cost;
cin.ignore();
getline(cin,line);

stringstream ss(line);
while(ss>>str)
{
kgCount++;
kgSum++;

}
kg[i] = kgCount;
cout<<"day "<<i+1<<": "<<kgCount<<" kg"<<endl;

}
printf("%.2lf kg by day\n",kgSum/n);
printf("R$ %.2lf by day\n",moneySum/n);


}

[/sourcecode]