View Code of Problem 96

#include <stdio.h>

#define N 1024
#define M 1000

int main()
{
	int n;
	long long m;
	char a, b;

	while(scanf("%d%c%c", &n, &a, &b) != EOF && n != 0){
		if(a == 'M'){
			m = n * (N * N - M * M);
		}
		if(a == 'G'){
			m = n * (N * N * N - M * M * M);
		}
		if(a == 'T'){
			m = n * (N * N * N * N - M * M * M * M);
		}
		if(a == 'B'){
			m = 0;
		}
		printf("%lld\n", m);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 96