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

水题,没有开数组,0MS,贴代码,供参考

Posted by denganliang at 2011-03-23 14:41:53 on Problem 3094
#include<stdio.h>

int main()
{
  char ch;
  int sum,i;
  while(1){
	  ch=getchar();
	  if(ch=='#')
	   break;
	   sum=0;
	   i=1;
	   sum+=(ch-'A'+1)*(i++);
	   
	   while(1){
		   ch=getchar();
		   if(ch=='\n') break;
		   if(ch==' ')
		     i++;
		    else{
				sum+=(ch-'A'+1)*(i++);
				}
		  
		   }
	   printf("%d\n",sum);
	  
	  }


  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