Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

水完今天最后一道明天接着来A题

Posted by nan5515522 at 2014-04-27 17:49:49 on Problem 3094
代码留在这作纪念
#include<iostream>
#include<Cstdio>


using namespace std;

char word[500];

int main()
{
	int count, sum, cha, pos;
	while(1)
	{
	    cin.getline(word, 500);
		//cout << word[0] << endl;
		if(word[0] == '#')
			break;
		count = 0, sum = 0;
		char *p = word;
		while (*p != '\0')
		{
			if(*p >= 'A' && *p <= 'Z')
				cha = *p - 'A' + 1;
			else if(*p == ' ')
				cha = 0;
			pos = p - word + 1;
			sum += pos * cha;
			p ++;
		}
		cout << sum << endl;
	
	}
   return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator