POJ 3094 Quicksum

超级水题,直接上代码:

#include<stdio.h>

int main()
{
	//char s[256];
	char ch;
	int count,value,quicksum;
	scanf("%c", &ch);
	while(ch != '#')
	{
		quicksum=0;
		count=1;
		
		while(ch != '\n')
		{
			if(ch==' ') value=0;
			else value=ch-'A'+1;
			quicksum += count*value;
			count++;
			scanf("%c", &ch);
		}
		printf("%d\n", quicksum);
		scanf("%c", &ch);
	}
	
	return 0;
}


你可能感兴趣的:(POJ 3094 Quicksum)