3 条题解
-
0无影 (吴鹏飞) LV 10 @ 2022-08-01 18:01:02
//由于数组不熟,所以没用数组
#include<iostream>
using namespace std;
int MonthDay(int month)
{
int day=31;
if(month==4||month==6||month==9||month==11)
day=30;
else
if(month==2)
day=28;
return day;
}
int main()
{
int m1=8,d1=1;
cin>>m1>>d1;
int m2=9,d2=5;
cin>>m2>>d2;
int day=d2;
for(int m=m1;m<m2;m++)
day+=MonthDay(m);
day-=d1;
cout<<day<<endl;
return 0;
} -
02021-02-14 20:11:03@
#include <iostream>//c++羸弱代码 using namespace std; int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int main() { int month,day,zhongjiancha,cha;cin>>month>>day; int month1,day1;cin>>month1>>day1; int benyuecha=a[month]-day; if(month+1==month1) { cha=a[month]-day; cout<<cha+day1; } if(month==month1) cout<<day1-day; if(month+1!=month1&&month!=month1) { for(int i=month+1;i<month1;i++) zhongjiancha+=a[i]; cout<<zhongjiancha+benyuecha+day1; } return 0; }
-
02019-08-15 12:28:03@
#include <stdio.h> int main() { int day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int x1, y1, x2, y2; while (scanf("%d%d%d%d", &x1, &y1, &x2, &y2) == 4) { if (x1 == x2) { printf("%d\n", y2 - y1); } else { int ans = day[x1] - y1 + y2; x1++; while (x1 != x2) { ans += day[x1]; x1++; } printf("%d\n", ans); } } return 0; }
- 1
信息
- ID
- 1083
- 难度
- 5
- 分类
- (无)
- 标签
- 递交数
- 526
- 已通过
- 174
- 通过率
- 33%
- 被复制
- 10
- 上传者