蒟蒻求助!52分!
查看原帖
蒟蒻求助!52分!
757049
bj12z_gengruilin楼主2023/4/22 19:18

WA了前四个点

#include<bits/stdc++.h>
using namespace std;
string n;
int num=1,b[4],a[4][4];
int main() {
	cin>>n;
	n[n.length()]='/';
	for(int i=0; i<=n.length(); i++) {
		if(n[i]=='/') {
			b[num]=(n[i-2]-48)*10+(n[i-1]-48);
			num++;
		}
	}
	if(b[1]==b[2]&&b[1]==b[3]) {
		cout<<20;
		if(b[1]<10) {
			cout<<0<<b[1];
		} else {
			cout<<b[1];
		}
		if(b[2]<10) {
			cout<<'-'<<0<<b[2];
		} else {
			cout<<'-'<<b[2];
		}
		if(b[3]<10) {
			cout<<'-'<<0<<b[3];
			cout<<endl;
		} else {
			cout<<'-'<<b[3];
			cout<<endl;
		}
		return 0;
	}
	a[1][1]=b[1];
	a[1][2]=b[2];
	a[1][3]=b[3];

	a[2][1]=b[3];
	a[2][2]=b[1];
	a[2][3]=b[2];

	a[3][1]=b[3];
	a[3][2]=b[2];
	a[3][3]=b[1];
	for(int i=1; i<=3; i++)
		if(a[i][2]>12||a[i][2]==0)a[i][1]=0;
	for(int i=1; i<=3; i++)
		if(a[i][3]>31||a[i][3]==0)a[i][1]=0;
	for(int i=1; i<=3; i++) {
		if(a[i][1]) {
			if(a[i][1]>59) {
				cout<<19;
				if(a[i][1]<10) {
					cout<<0<<a[i][1];
				} else {
					cout<<a[i][1];
				}
				if(a[i][2]<10) {
					cout<<'-'<<0<<a[i][2];
				} else {
					cout<<'-'<<a[i][2];
				}
				if(a[i][3]<10) {
					cout<<'-'<<0<<a[i][3];
					if(i>1)cout<<endl;
				} else if(a[i][3]>9){
					cout<<'-'<<a[i][3];
					if(i>1)cout<<endl;
				}
			} else if(a[i][1]<=59){
				cout<<20;
				if(a[i][1]<10) {
					cout<<0<<a[i][1];
				} else {
					cout<<a[i][1];
				}
				if(a[i][2]<10) {
					cout<<'-'<<0<<a[i][2];
				} else {
					cout<<'-'<<a[i][2];
				}
				if(a[i][3]<10) {
					cout<<'-'<<0<<a[i][3];
					if(i>1)cout<<endl;
				} else if(a[i][3]>9) {
					cout<<'-'<<a[i][3];
					if(i>1)cout<<endl;
				}
			}
		}
	}
	return 0;
}
2023/4/22 19:18
加载中...