Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
入门中( compile error几次 。。可恶) 发下ac代码#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator