'commit'
This commit is contained in:
49
LuoGu/RuMen/P1615.cpp
Normal file
49
LuoGu/RuMen/P1615.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/**
|
||||
* 功能:将字符串转为整数
|
||||
* 作者:黄海
|
||||
* 时间:2019-11-24
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
unsigned int stou(const string &str) {
|
||||
unsigned int n;
|
||||
stringstream ssTmp(str);
|
||||
ssTmp >> n;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
long long getSenconds(string temp) {
|
||||
int count = 0;
|
||||
int shi, fen, miao = 0;
|
||||
|
||||
string str = "";
|
||||
for (int i = 0; i < temp.size(); i++) {
|
||||
if (temp[i] != ':') {
|
||||
str += temp[i];
|
||||
} else {
|
||||
count++;
|
||||
if (count == 1) shi = stou(str);
|
||||
if (count == 2) fen = stou(str);
|
||||
str = "";
|
||||
}
|
||||
}
|
||||
miao = stou(str);
|
||||
return shi * 60 * 60 + fen * 60 + miao;
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
ios::sync_with_stdio(false); //读入输出优化的强迫症
|
||||
|
||||
string a, b;
|
||||
int c;
|
||||
cin >> a >> b >> c;
|
||||
long long q = getSenconds(b) - getSenconds(a);
|
||||
cout << q * c << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user