求助,为什么是0分?
查看原帖
求助,为什么是0分?
273435
l_yu楼主2022/8/23 20:53

样例和下载的测试点1答案都是对的,可为什么全WA了?

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
LL read() {
	LL f=2,sum=0,cnt=0;
	char c;
	while(cin>>c) {
		if(c==':') {
			if(f==2) {
				cnt+=sum*3600;
				
			} else if(f==1) {
				cnt+=sum*60;
				
			}
			f--;
			sum=0;
		} else if(c>='0'&&c<='9') {
			sum=sum*10+c-48;
		} else break;
	}
	cnt+=sum;
	return cnt;
}
int main() {
	LL a,b,c;
	a=read();
	b=read();
	cin>>c;
	cout<<(b-a)*c;
	return 0;
}
2022/8/23 20:53
加载中...