1 条题解
-
0
C :
#include <stdio.h> int main() { int year, a, b, c; scanf("%d", &year); a = year % 4; if(a == 0) { b = year % 100; if(b == 0) { c = year % 400; if(c == 0) printf("leap year\n"); else printf("not leap year\n"); } else printf("leap year\n"); } else printf("not leap year\n"); return 0; system("pause"); }
C++ :
#include <iostream> using namespace std; int main() { int a; cin>>a; if(a%100==0) { if(a%400==0) cout<<"leap year"<<endl; else cout<<"not leap year"<<endl; } else { if(a%4==0) cout<<"leap year"<<endl; else cout<<"not leap year"<<endl; } return 0; }
- 1
信息
- ID
- 546
- 时间
- 1000ms
- 内存
- 12MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者