3 条题解
-
0
#include <stdio.h> int main(){ int a,b,c; int date[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int t; scanf("%d",&t); while(t--){ scanf("%d %d %d" , &a , &b , &c ); if(c + b <= date[a]){ printf("%d %d\n", a , b + c); } else if (b + c > date[a]){ c -= date[a] - b; int flag = 0; for (int i=a+1 ; i<=12 ; i++){ if (c > date[i]){ c -= date[i]; } else if(c < date[i]) { printf("%d %d\n", i ,c ); flag = 1; break; } } if(!flag){ printf("^_^\n"); } } } return 0;
}
-
0
#include <bits/stdc++.h> using namespace std; #define int long long int date[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; void solve(){ int b,c,d; cin >> b >> c >> d; if(d + c <= date[b]){ cout << b << ' ' << d + c << endl; return; } d -= date[b]-c; for(int i = b + 1; i <= 12; i++){ if(d > date[i]) { d -= date[i]; } else{ cout << i << ' '<< d << endl; return; } } cout<<"^_^"<<endl; } signed main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int T = 1; cin >> T; while(T--){ solve(); } return 0; } -
0
#include<bits/stdc++.h> #define int long long using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(),cout.tie(0); int t; cin >> t; while(t--) { int mon,day,time; cin >> mon >> day >> time; int ai[15]={0,31,28,31,30,31,30,31,31,30,31,30,31};//把月份用数组表示出来 int ans_mon=mon; int ans_day=day;//答案初始化 int now_mon=ai[mon]-day;//本月剩余天数 if(now_mon>=time)//保质期到本月之内 { cout << mon << " " << day+time << endl;//输出日期+保质期 continue; } ans_mon++;//超过本月 月份+1 if(ans_mon>12)//月份变化则判断一下 { cout << "^_^\n"; continue; } ans_day=0;//新的一月天数从0计 time-=now_mon;//上述条件全部符合 保质期-上月用到的天数 while(time>0) { if(ans_mon>12)//超本年跳出 { break; } if(time>ai[ans_mon])//保质期大于超过本月 { time-=ai[ans_mon]; ans_mon++; ans_day=0; } else//在本月之内 { ans_day+=time; break; } } if(ans_mon>12) { cout << "^_^\n"; } else { cout << ans_mon << " " << ans_day << endl; } } }
- 1
信息
- ID
- 486
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- (无)
- 递交数
- 95
- 已通过
- 18
- 上传者