题解 | #今年的第几天?#
今年的第几天?
https://www.nowcoder.com/practice/ae7e58fe24b14d1386e13e7d70eaf04d
#include <iostream> using namespace std; int main() { int year,month,day; while(cin>>year>>month>>day){ int arr[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; if((year%400==0)||(year%100!=0&&year%4==0)) arr[2]++; //开始判断 for(int i =1;i<month;i++) day+=arr[i]; cout<<day<<endl; } } // 64 位输出请用 printf("%lld")