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

hawk我的程序为什么WA?

Posted by lily at 2005-09-03 14:35:02 on Problem 2273
#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:
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