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 |
hawk我的程序为什么WA?#include<iostream> #include<vector> #include<cmath> #include<string> using namespace std; int main() { string s; while(cin>>s&&s!="R0C0") { int mark=2; for(int i=mark;i<s.length();++i) if(s[i]=='C') { mark=i; break; } int x=0,y=0; for(int i=1;i<mark;++i) x+=(int(s[i])-int('0'))*pow(10.0,1.0*(mark-1-i)); for(int i=mark+1;i<s.length();++i) y+=(int(s[i])-int('0'))*pow(10.0,1.0*(s.length()-1-i)); vector<char> v; v.clear(); int k; while(y) { k=y%26; if(k==0) v.push_back('Z'); else v.push_back(char(k+64)); if(k==0) y-=26; else y-=k; y/=26; } for(int i=v.size()-1;i>=0;--i) cout<<v[i]; cout<<x<<'\n'; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator