标题:第几天
2000年的1月1日,是那一年的第1天。 那么,2000年的5月4日,是那一年的第几天?
注意:需要提交的是一个整数,不要填写任何多余内容。
代码#include using namespace std; int main() { int year=2000,month=1,day=1,ans=0; while(1) { day++; ans++; if(day==32&&(month==1||month==3||month==5)) { day=1; month++; } if(day==29&&month==2) { day=1; month=3; } if(day==31&&month==4) { month++; day=1; } if(month==5&&day==4) break; } cout<<ans+1<<endl; return 0; }