关于杭电2029题Identity Card不能AC的疑惑
题目地址:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1§ionid=2&problemid=25
以下是我的代码:
#include<iostream>
#include<string>
using namespace std;
int main(){
int n,i;
string s,place;
cin>>n;
for(i=0;i<n;i++)
{
cin>>s;
int sp;
sp=stoi(s.substr(0,2));
switch(sp){
case 33:
place="Zhejiang";
break;
case 11:
place="Beijing";
break;
case 71:
place="*";
break;
case 81:
place="*";
break;
case 82:
place="Macao";
break;
case 54:
place="Tibet";
break;
case 21:
place="Liaoning";
break;
case 31:
place="Shanghai";
break;
default:
return 0;
}
int year=stoi(s.substr(6,4));
int month=stoi(s.substr(10,2));
int day=stoi(s.substr(12,2));
cout<<"He/She is from "<<place<<",and his/her birthday is on "<<month<<","<<day<<","<<year<<" based on the table."<<endl;
}
return 0;
}
本地运行是对的,可是提交时一直是Wrong Answer.希望有大佬能够解答.