পৃষ্ঠাসমূহ

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

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]

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন