80qiuzhu
查看原帖
80qiuzhu
1392483
KUN12135楼主2024/11/22 17:22

#include using namespace std; int M, T, ZT, JT, VT; long long S, Z;

//M=39,S=200,T=4 int main() { cin >> M >> S >> T; Z = 0; ZT = 0; while (true) { if (Z >= S) { cout << "Yes" << endl; cout << ZT; break; } else if (ZT >= T) { cout << "No" << endl;//M=39,S=200,T=4 cout << Z ; break; } if (M >= 10) { Z = Z + (M / 10) * 60; ZT += (M / 10); M -= (M / 10) * 10; } else { JT = (10 - M) / 4; if ((10 - M) % 4 != 0) JT++;//JT=3 if ((S - Z) < 60) { VT = (S - Z) / 17; if ((S - Z) % 17 != 0) VT++; if (VT < (JT + 1)) {//M=39,S=200,T=4 if (ZT + VT > T) { Z += (T - ZT) * 17; ZT = T; continue; } ZT += VT; Z += VT * 17; } else { if (ZT + JT + 1 > T) { Z += (T - ZT) * 17; ZT = T; continue; } ZT += JT; ZT++; Z += 60; M -= 10; } } else { if (ZT + JT > T) { Z += (T - ZT) * 17; ZT = T; continue; } ZT += JT; M += JT * 4;

		}

	}
}

return 0;

}

#include <iostream>
using namespace std;
int M, T, ZT, JT, VT;
long long S, Z;

//M=39,S=200,T=4
int main() {
	cin >> M >> S >> T;
	Z = 0;
	ZT = 0;
	while (true) {
		if (Z >= S) {
			cout << "Yes" << endl;
			cout << ZT;
			break;
		} else if (ZT >= T) {
			cout << "No" << endl;//M=39,S=200,T=4
			cout << Z ;
			break;
		}
		if (M >= 10) {
			Z = Z + (M / 10) * 60;
			ZT += (M / 10);
			M -= (M / 10) * 10;
		} else {
			JT = (10 - M) / 4;
			if ((10 - M) % 4 != 0)
				JT++;//JT=3
			if ((S - Z) < 60) {
				VT = (S - Z) / 17;
				if ((S - Z) % 17 != 0)
					VT++;
				if (VT < (JT + 1)) {//M=39,S=200,T=4
					if (ZT + VT > T) {
						Z += (T - ZT) * 17;
						ZT = T;
						continue;
					}
					ZT += VT;
					Z += VT * 17;
				} else {
					if (ZT + JT + 1 > T) {
						Z += (T - ZT) * 17;
						ZT = T;
						continue;
					}
					ZT += JT;
					ZT++;
					Z += 60;
					M -= 10;
				}
			} else {
				if (ZT + JT > T) {
					Z += (T - ZT) * 17;
					ZT = T;
					continue;
				}
				ZT += JT;
				M += JT * 4;

			}

		}
	}

	return 0;
}

2024/11/22 17:22
加载中...