1. 程式人生 > >CodeForces 785A Anton and Polyhedrons

CodeForces 785A Anton and Polyhedrons

pac cst mat () ant algo ring light str

簡單判斷。

分別判斷每個單詞是幾面體,加起來就是答案。

#include <cstdio>
#include <cmath>
#include <cstring>
#include <map>
#include <algorithm>
using namespace std;

int n;
char s[1000];
int sum;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s);
		if(s[0]==‘T‘) sum+=4;
		if(s[0]==‘C‘) sum+=6;
		if(s[0]==‘O‘) sum+=8;
		if(s[0]==‘D‘) sum+=12;
		if(s[0]==‘I‘) sum+=20;

	}
	printf("%d\n",sum);
	return 0;
}

CodeForces 785A Anton and Polyhedrons