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 |
谁帮我看看为什么wa了#include<iostream> #include<string> #include<cmath> using namespace std; int main(){ int i; float num=9; char str[30]; while((scanf("%s",str)!=0)&&(str[0]!='0')){ int j=0; int x=0; for(i=0;i<(int)strlen(str);i++){ if(str[i]>='4') j+=(int)pow(num,(int)strlen(str)-i-1); x+=(int)(str[i]-'0')*(int)pow(num,(int)strlen(str)-i-1); } printf("%s: %d\n",str,x-j); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator