1001答案

Papyrus在审判你  •  2年前


include<stdio.h>

int main( ) {

int a,b;
scanf("%d %d",&a,&b);
printf("%d",a+b);
return 0;

}


评论:

include <bits/stdc++.h>

include

using namespace std;

int main() {

int num; cin >> num; string ids[num]; for (int i = 0; i < num; i++) {

cin >> ids[i];

} for (int i = 0; i < num; i++) {

string id = ids[i];
int year = (id[6] - '0' ) * 1000 + (id[7] - '0') * 100 + (id[8] - '0') * 10 + (id[9] - '0');
int month = (id[10] - '0') * 10 + (id[11] - '0');
int day = (id[12] - '0') * 10 + (id[13] - '0');
if (year >= 1980 && year <= 2006 || year == 2007 && month == 1 && day == 1) {
	if (month >= 1 && math <= 12) {
		if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
			if (day > 31 || day <= 0) {
				cout << 'D' << endl;
			}
		} else {
			//校验码
		}
		if (month == 4 || month == 6 || month == 9 || month == 11 ) {
			if (day > 30 || day <= 0) {
				cout << 'D' << endl;
			}
		} else {
			//校验码
		}
		if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
			if (day > 29 || day <= 0)
				cout << 'D' << endl;
		} else {
			if (day > 28 || day <= 0)
				cout << 'D' << endl;
		}else{
			//校验码
		}
	} else
		cout << 'M' << endl;

} else
	cout << 'Y' << endl;

}

return 0; } //530102200901019736


刘谦  •  2年前

include <bits/stdc++.h>

include

using namespace std;

int main() {

int num;
cin >> num;
string ids[num];
for (int i = 0; i < num; i++) {
	cin >> ids[i];
}

for (int i = 0; i < num; i++) {
	string id = ids[i];
	int year = (id[6] - '0' ) * 1000 + (id[7] - '0') * 100 + (id[8] - '0') * 10 + (id[9] - '0');
	int math = (id[10] - '0') * 10 + (id[11] - '0');
	int day = (id[12] - '0') * 10 + (id[13] - '0');
	if (year >= 1980 && year <= 2006 || year == 2007 && math == 1 && day == 1) {
		if (math >= 1 && math <= 12) {
			if (math == 1 || math == 3 || math == 5 || math == 7 || math == 8 || math == 10 || math == 12) {
				if (day > 31 || day <= 0) {
					cout << 'D' << endl;
				}
			}
			if (math == 4 || math == 6 || math == 9 || math == 11 ) {
				if (day > 30 || day <= 0) {
					cout << 'D' << endl;
				}
			}
			if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
				if (day > 29 || day <= 0)
					cout << 'D' << endl;
			} else {
				if (day > 28 || day <= 0)
					cout << 'D' << endl;
			}
		} else
			cout << 'M' << endl;

	} else
		cout << 'Y' << endl;
}

return 0;

} //530102200901019736


刘宸志 CEUA  •  2年前

include

include

using namespace std;

int main() {

int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
int total;
cin >> total;
bool pass = true;     //  是否全都正确输入all passed
for (int i = 0; i < total; i++) {
	string ID;
	cin >> ID;
	int z = 0;     //    z求校验码
	bool pass_i = true;   //  第i个是否正确
	for (int j = 0; j < ID.length() - 1; j++) {
		if (ID[j] >= 48 && ID[j] <= 57)     // 确认每一位是数字
			z += weight[j] * (ID[j] - '0');
		else {
			pass = false;
			pass_i = false;
		}
	}
	z %= 11;
	if (!pass_i || ID[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
		for (int i = 0; i < ID.length() - 1; i++) {
			cout << ID[i];
		}
		cout << ZM[z];
	}
}

}


刘宸志 CEUA  •  2年前

不报错了,但会重复输出 案例如下 2 532101200002301134 532101200002291134 输出 532101200002301135532101200002301135D D 532101200002291133532101200002291133D 代码

include <bits/stdc++.h>

include

using namespace std;

int main() {

int num;
cin >> num;
string ids[num];
for (int i = 0; i < num; i++) {
	cin >> ids[i];
}

for (int i = 0; i < num; i++) {
	string id = ids[i];
	int year = (id[6] - '0' ) * 1000 + (id[7] - '0') * 100 + (id[8] - '0') * 10 + (id[9] - '0');
	int math = (id[10] - '0') * 10 + (id[11] - '0');
	int day = (id[12] - '0') * 10 + (id[13] - '0');
	if (year >= 1980 && year <= 2006 || year == 2007 && math == 1 && day == 1) {
		if (math >= 1 && math <= 12) {
			if (math == 1 || math == 3 || math == 5 || math == 7 || math == 8 || math == 10 || math == 12) {
				if (day > 31 || day <= 0) {
					cout << 'D' << endl;
				}
			} else {
				int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
				char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
				int z = 0;
				bool pass = true;
				bool pass_i = true;
				for (int j = 0; j < id.length() - 1; j++) {
					if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
						z += weight[j] * (id[j] - '0');
					else {
						pass = false;
						pass_i = false;
					}
				}
				z %= 11;
				if (!pass_i || id[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
					for (int i = 0; i < id.length() - 1; i++) {
						cout << id[i];
					}
					cout << ZM[z];
				}
			}
			if (math == 4 || math == 6 || math == 9 || math == 11 ) {
				if (day > 30 || day <= 0) {
					cout << 'D' << endl;
				}
			} else {
				int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
				char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
				int z = 0;
				bool pass = true;
				bool pass_i = true;
				for (int j = 0; j < id.length() - 1; j++) {
					if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
						z += weight[j] * (id[j] - '0');
					else {
						pass = false;
						pass_i = false;
					}
				}
				z %= 11;
				if (!pass_i || id[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
					for (int i = 0; i < id.length() - 1; i++) {
						cout << id[i];
					}
					cout << ZM[z];
				}
			}
			if (math == 2) {
				if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
					if (day > 29 || day <= 0)
						cout << 'D' << endl;
				} else {
					int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
					char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
					int z = 0;
					bool pass = true;
					bool pass_i = true;
					for (int j = 0; j < id.length() - 1; j++) {
						if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
							z += weight[j] * (id[j] - '0');
						else {
							pass = false;
							pass_i = false;
						}
					}
					z %= 11;
					if (!pass_i || id[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
						for (int i = 0; i < id.length() - 1; i++) {
							cout << id[i];
						}
						cout << ZM[z];
					}

				}
				if (day > 28 || day <= 0)
					cout << 'D' << endl;
				else {
					int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
					char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
					int z = 0;
					bool pass = true;
					bool pass_i = true;
					for (int j = 0; j < id.length() - 1; j++) {
						if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
							z += weight[j] * (id[j] - '0');
						else {
							pass = false;
							pass_i = false;
						}
					}
					z %= 11;
					if (!pass_i || id[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
						for (int i = 0; i < id.length() - 1; i++) {
							cout << id[i];
						}
						cout << ZM[z];
					}
				}
			}
		} else
			cout << 'M' << endl;

	} else
		cout << 'Y' << endl;
}

return 0;

} //530102200901019736


刘宸志 CEUA  •  2年前

最优化了,但输出不了D。

include <bits/stdc++.h>

include

using namespace std;

int main() {

int num;
cin >> num;
string ids[num];
for (int i = 0; i < num; i++) {
	cin >> ids[i];
}

for (int i = 0; i < num; i++) {
	string id = ids[i];
	int year = (id[6] - '0' ) * 1000 + (id[7] - '0') * 100 + (id[8] - '0') * 10 + (id[9] - '0');
	int math = (id[10] - '0') * 10 + (id[11] - '0');
	int day = (id[12] - '0') * 10 + (id[13] - '0');
	if (year >= 1980 && year <= 2006 || year == 2007 && math == 1 && day == 1) {
		if (math >= 1 && math <= 12) {
			if (math == 1 || math == 3 || math == 5 || math == 7 || math == 8 || math == 10 || math == 12) {
				if (day > 31 || day <= 0) {
				}
			} else {
				int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
				char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
				int z = 0;
				bool pass = true;
				bool pass_i = true;
				for (int j = 0; j < id.length() - 1; j++) {
					if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
						z += weight[j] * (id[j] - '0');
					else {
						pass = false;
						pass_i = false;
					}
				}
				z %= 11;
				if (!pass_i || id[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
					for (int i = 0; i < id.length() - 1; i++) {
						cout << id[i];
					}
					cout << ZM[z];
					return 0;
				}
			}
			if (math == 4 || math == 6 || math == 9 || math == 11 ) {
				if (day > 30 || day <= 0) {
					cout << 'D' << endl;
				}
			} else {
				int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
				char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
				int z = 0;
				bool pass = true;
				bool pass_i = true;
				for (int j = 0; j < id.length() - 1; j++) {
					if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
						z += weight[j] * (id[j] - '0');
					else {
						pass = false;
						pass_i = false;
					}
				}
				z %= 11;
				if (!pass_i || id[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
					for (int i = 0; i < id.length() - 1; i++) {
						cout << id[i];
					}
					cout << ZM[z];
					return 0;
				}
			}
			if (math == 2) {
				if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
					if (day > 29 || day <= 0)
						cout << 'D' << endl;
				} else {
					int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
					char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
					int z = 0;
					bool pass = true;
					bool pass_i = true;
					for (int j = 0; j < id.length() - 1; j++) {
						if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
							z += weight[j] * (id[j] - '0');
						else {
							pass = false;
							pass_i = false;
						}
					}
					z %= 11;
					if (!pass_i || id[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
						for (int i = 0; i < id.length() - 1; i++) {
							cout << id[i];
						}
						cout << 'D' << endl;
						cout << ZM[z];
						return 0;
					}

				}
				if (day > 28 || day <= 0)
					cout << 'D' << endl;
				else {
					int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
					char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
					int z = 0;
					bool pass = true;
					bool pass_i = true;
					for (int j = 0; j < id.length() - 1; j++) {
						if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
							z += weight[j] * (id[j] - '0');
						else {
							pass = false;
							pass_i = false;
						}
					}
					z %= 11;
					if (!pass_i || id[17] != ZM[z]) { //   第i个身份证不是全为数字或校验码不对
						for (int i = 0; i < id.length() - 1; i++) {
							cout << id[i];
						}
						cout << ZM[z];
						return 0;
					}
				}
			}
		} else
			cout << 'M' << endl;

	} else
		cout << 'Y' << endl;
}

return 0;

} //530102200901019736


刘谦  •  2年前

不知道对不对,你上面给的数据是对的,但我没题目,不好判断对不对。

include <bits/stdc++.h>

include

using namespace std;

int main() {

int num;
cin >> num;
string ids[num];
for (int i = 0; i < num; i++) {
	cin >> ids[i];
}

for (int i = 0; i < num; i++) {
	string id = ids[i];
	int year = (id[6] - '0' ) * 1000 + (id[7] - '0') * 100 + (id[8] - '0') * 10 + (id[9] - '0');
	int math = (id[10] - '0') * 10 + (id[11] - '0');
	int day = (id[12] - '0') * 10 + (id[13] - '0');
	if (year >= 1980 && year <= 2006 || year == 2007 && math == 1 && day == 1) {
		if (math >= 1 && math <= 12) {
			if (math == 1 || math == 3 || math == 5 || math == 7 || math == 8 || math == 10 || math == 12) {
				if (day > 31 || day <= 0) {
				}
			} else {
				int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
				char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
				int z = 0;
				bool pass = true;
				bool pass_i = true;
				for (int j = 0; j < id.length() - 1; j++) {
					if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
						z += weight[j] * (id[j] - '0');
					else {
						pass = false;
						pass_i = false;
					}
				}
				z %= 11;
				if (!pass_i || id[17] != ZM[z]) {
					cout << 'D' << endl;
					for (int i = 0; i < id.length() - 1; i++) {
						cout << id[i];
					}
					cout << ZM[z];
					return 0;
				}
			}
			if (math == 4 || math == 6 || math == 9 || math == 11 ) {
				if (day > 30 || day <= 0) {
					cout << 'D' << endl;
				}
			} else {
				int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
				char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
				int z = 0;
				bool pass = true;
				bool pass_i = true;
				for (int j = 0; j < id.length() - 1; j++) {
					if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
						z += weight[j] * (id[j] - '0');
					else {
						pass = false;
						pass_i = false;
					}
				}
				z %= 11;
				if (!pass_i || id[17] != ZM[z]) {
					cout << 'D' << endl;
					for (int i = 0; i < id.length() - 1; i++) {
						cout << id[i];
					}
					cout << ZM[z];
					return 0;
				}
			}
			if (math == 2) {
				if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
					if (day > 29 || day <= 0)
						cout << 'D' << endl;
				} else {
					int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
					char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
					int z = 0;
					bool pass = true;
					bool pass_i = true;
					for (int j = 0; j < id.length() - 1; j++) {
						if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
							z += weight[j] * (id[j] - '0');
						else {
							pass = false;
							pass_i = false;
						}
					}
					z %= 11;
					if (!pass_i || id[17] != ZM[z]) {
						cout << 'D' << endl;
						for (int i = 0; i < id.length() - 1; i++) {
							cout << id[i];
						}
						cout << ZM[z];
						return 0;
					}

				}
				if (day > 28 || day <= 0)
					cout << 'D' << endl;
				else {
					int weight[17] = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
					char ZM[11] = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' };
					int z = 0;
					bool pass = true;
					bool pass_i = true;
					for (int j = 0; j < id.length() - 1; j++) {
						if (id[j] >= 48 && id[j] <= 57)     // 确认每一位是数字
							z += weight[j] * (id[j] - '0');
						else {
							pass = false;
							pass_i = false;
						}
					}
					z %= 11;
					if (!pass_i || id[17] != ZM[z]) {
						cout << 'D' << endl;
						for (int i = 0; i < id.length() - 1; i++) {
							cout << id[i];
						}
						cout << ZM[z];
						return 0;
					}
				}
			}
		} else
			cout << 'M' << endl;

	} else
		cout << 'Y' << endl;
}

return 0;

} //530102200901019736


刘谦  •  2年前

include <bits/stdc++.h>

using namespace std; int n,f[55]; int main(){ cin>>n; f[0]=2;f[1]=2; for(int i=2;i<n;i++) { f[i]=f[i-1]+f[i-2]; } cout<<f[n-1]; return 0; }


root  •  2年前

请先登录,才能进行评论