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

入门中( compile error几次 。。可恶) 发下ac代码

Posted by _roronoa at 2016-09-27 11:22:12 on Problem 3094
#include <cstdio>
#include <iostream>
using namespace std;

int Getvalue(int pos,char t)
{
	return pos*(int(t)-64);
}

int main()
{
	while(true)
	{
		int t;
		int pos=0;
		int sum=0;
		
		while( (t=getchar()) )
		{
			if(t=='#')return 0;
			else if(t==' ')pos++;
			else if(t=='\n')
			{
				printf("%d\n",sum);
				pos=sum=0;
			}
			else 
			{
				pos++;
				sum+=Getvalue(pos,t);
			}
		}
	}
	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