关于#2
查看原帖
关于#2
191248
Genshineer楼主2021/7/28 19:04
#include <bits/stdc++.h>
using namespace std;
const string Date[12]=\
{"31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31"};
const string Month[12]=\
{"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
string s, m, d;
int mm, dd, tot, tot1, tot2, tot3;
int main( ) {
	cin >> s;
	m = s.substr(0,2);
	d = s.substr(3,2);
	mm = (s[0] - '0') * 10 + (s[1] - '0');
	dd = (s[3] - '0') * 10 + (s[4] - '0');
	if(mm > 0 && mm < 13) {
		tot = 0;
		if(Date[mm - 1][0] < d[0] || (Date[mm - 1][0] >= d[0] && Date[mm - 1][1] < d[1])) {
			tot++;
		}
		cout << tot;
	}
	else 
		if(mm > 0){
			tot1 = 1;
			int mmm = mm % 10;
			if(Date[mmm - 1][0] < d[0] || (Date[mmm - 1][0] >= d[0] && Date[mmm - 1][1] < d[1]) || dd == 0) {
				tot1++;
			}
			tot2 = 0x3f3f3f;
			if(mm % 10 < 3) {
				tot2 = 1;
				int mmm = mm % 10 + 10;
				if(Date[mmm - 1][0] < d[0] || (Date[mmm - 1][0] >= d[0] && Date[mmm - 1][1] < d[1]) || dd == 0) {
					tot2++;
				}
			}
			cout << min(tot1, tot2);
		}
		else {
			tot1 = 1;
			int mmm = 1;
			if(Date[mmm - 1][0] < d[0] || (Date[mmm - 1][0] >= d[0] && Date[mmm - 1][1] < d[1]) || dd == 0) {
				tot1++;
			}
			tot2 = 1;
			mmm = 2;
			if(Date[mmm - 1][0] < d[0] || (Date[mmm - 1][0] >= d[0] && Date[mmm - 1][1] < d[1]) || dd == 0) {
				tot2++;
			}
			tot3 = 1;
			mmm = 4;
			if(Date[mmm - 1][0] < d[0] || (Date[mmm - 1][0] >= d[0] && Date[mmm - 1][1] < d[1]) || dd == 0) {
				tot3++;
			}
			cout << min(tot1, min(tot2, tot3));
		}
}

为什么我调了半小时#2都是RE,其他都对了...

2021/7/28 19:04
加载中...