致没看懂题目的你

P1178 到天宫做客

还是不懂(悲)
by weifeng_yuhuo @ 2023-07-12 15:57:35


```c #include<bits/stdc++.h> using namespace std; int a[10001],n,x,y,t; int f(int m1,int d1) { int s=0; for(int i=1;i<=m1-1;i++) if(i==1 || i==3|| i==5 || i==7 || i==8 || i==10 || i==12) s+=31; else if(i==2) s+=29; else s+=30; return s+d1; } int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>x>>y; a[i]=f(x,y); } sort(a+1,a+n+1); t=a[1]-1; for(int i=2;i<=n+1;i++) { if(a[i]-a[i-1]-1>t) t=a[i]-a[i-1]-1; } if(366-a[n]>t) t=366-a[n]; cout<<round(t*86400.0/366)<<endl; return 0; } ```
by joe_001 @ 2024-01-27 11:13:56


这样写就对了。
by joe_001 @ 2024-01-27 11:15:09


|