文章
19
粉丝
0
获赞
66
访问
3.3k
#include<bits/stdc++.h>
using namespace std;
bool isYear(int x){
if((x%400==0)|| ((x%4==0) && (x%100!=0)) ){
return true;
}else{
return false;
}
}
int mouth[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
string s;
cin >> s;
int ans = 0;
int pos1 = s.find('-');
int pos2 = s.rfind('-');
int y = stoi(s.substr(0,pos1));
int m = stoi(s.substr(pos1 + 1, pos2 - pos1 - 1));
int d = stoi(s.substr(pos2 + 1));
if(isYear(y)){
mouth[2]=29;
}
for(int i=1;i<m;i++){
ans += mouth[i];
}
 ...
登录后发布评论
暂无评论,来抢沙发