#include <iostream>
using namespace std;
int main(){
int n;
while (cin >>n){
for (int i=0;i<n;i++){
int h1,m1,h2,m2,t;
cin >>h1 >>m1 >>h2 >>m2 >>t;
if (h1==h2){
if (m1+t>m2){
cout <<"No" <<endl;
}else{
cout <<"Yes" <<endl;
}
}else{
if (m1+t>60){
int m3=m1+t;
for (m3;m3>=60;m3=m3-60){
h1+=1;
}
if (h1>h2){
cout <<"No" <<endl;
}else if (h1==h2){
if (m3>m2){
cout <<"No" <<endl;
}else{
cout <<"Yes" <<endl;
}
}else{
cout <<"Yes" <<endl;
}
}
}
}
}
return 0;
}
請問我哪裡有寫錯
#include
using namespace std;
int main(){
int n;
while (cin >>n){
for (int i=0;i<n;i++){
int h1,m1,h2,m2,t;
cin >>h1 >>m1 >>h2 >>m2 >>t;
if (h1==h2){
if (m1+t>m2){
cout <<"No" <<endl;
}else{
cout <<"Yes" <<endl;
}
}else{
if (m1+t>60){
int m3=m1+t;
for (m3;m3>=60;m3=m3-60){
h1+=1;
}
if (h1>h2){
cout <<"No" <<endl;
}else if (h1==h2){
if (m3>m2){
cout <<"No" <<endl;
}else{
cout <<"Yes" <<endl;
}
}else{
cout <<"Yes" <<endl;
}
}
}
}
}
return 0;
}
請問我哪裡有寫錯
為什麼不直接乘
#include
using namespace std;
int main(){
int n;
while (cin >>n){
for (int i=0;i<n;i++){
int h1,m1,h2,m2,t;
cin >>h1 >>m1 >>h2 >>m2 >>t;
if (h1==h2){
if (m1+t>m2){
cout <<"No" <<endl;
}else{
cout <<"Yes" <<endl;
}
}else{
if (m1+t>60){
int m3=m1+t;
for (m3;m3>=60;m3=m3-60){
h1+=1;
}
if (h1>h2){
cout <<"No" <<endl;
}else if (h1==h2){
if (m3>m2){
cout <<"No" <<endl;
}else{
cout <<"Yes" <<endl;
}
}else{
cout <<"Yes" <<endl;
}
}
}
}
}
return 0;
}
請問我哪裡有寫錯
為什麼不直接乘
想說試試其他的ww
#include
using namespace std;
int main(){
int n;
while (cin >>n){
for (int i=0;i<n;i++){
int h1,m1,h2,m2,t;
cin >>h1 >>m1 >>h2 >>m2 >>t;
if (h1==h2){
if (m1+t>m2){
cout <<"No" <<endl;
}else{
cout <<"Yes" <<endl;
}
}else{
if (m1+t>60){
int m3=m1+t;
for (m3;m3>=60;m3=m3-60){
h1+=1;
}
if (h1>h2){
cout <<"No" <<endl;
}else if (h1==h2){
if (m3>m2){
cout <<"No" <<endl;
}else{
cout <<"Yes" <<endl;
}
}else{
cout <<"Yes" <<endl;
}
}
}
}
}
return 0;
}
請問我哪裡有寫錯
為什麼不直接乘
想說試試其他的ww
判斷時用 >=,用>會WA