View Code of Problem 3794

#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;


int main()
{
	int T, i;
	float ans = 0.0;
	int l;
	char str1[300];
	char str2[300];
	int len1, len2;
	scanf("%d", &T);
	getchar();
	for (i = 1; i <= T; i++)
	{
		gets(str1);
		gets(str2);
		len1=strlen(str1);
		len2 = strlen(str2);
		for (l = 0; l < len1; l++)
		{
			if (str1[l] == 'O')
				ans += 2.0;
			else if (str1[l] == 'U')
				ans += 10.5;
			else if (str1[l] == '$')
				ans += 7.0;
		}
		for (l = 0; l < len2; l++)
		{
			if (str2[l] == 'O')
				ans += 2.0;
			else if (str2[l] == 'U')
				ans += 10.5;
			else if (str2[l] == '$')
				ans += 7.0;
		}
		cout << "Case #" << i << ":$" <<ans << endl;
		memset(str1, 0, sizeof(str1));
		memset(str2, 0, sizeof(str2));
		ans = 0.0;
	}


	return 0;
}

/*
Main.cc: In function 'int main()':
Main.cc:19:3: warning: 'char* gets(char*)' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(str1);
   ^
Main.cc:19:12: warning: 'char* gets(char*)' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(str1);
            ^
Main.cc:20:3: warning: 'char* gets(char*)' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(str2);
   ^
Main.cc:20:12: warning: 'char* gets(char*)' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(str2);
            ^
Main.cc:41:3: error: 'cout' was not declared in this scope
   cout << "Case #" << i << ":$" <<ans << endl;
   ^
Main.cc:41:42: error: 'endl' was not declared in this scope
   cout << "Case #" << i << ":$" <<ans << endl;
                                          ^
*/

Double click to view unformatted code.


Back to problem 3794