LeetCode Weekly Contest 151
問題文
省略
省略
C++に変換後のコードはこちら
#define main dummy_main
{}
#undef main
class Solution {
public:
vector<string> invalidTransactions(vector<string>& in) {
int i, j, N;
string name[1000], city[1000];
int tm[1000], amount[1000];
char buf1[1000], buf2[1000];
vector<string> res;
N = in.size();
rep(i,N){
sscanf(in[i].c_str(), "%[^,],%d,%d,%[^,]", buf1, tm+i, amount+i, buf2);
name[i] = buf1;
city[i] = buf2;
}
rep(i,N){
rep(j,N) if(amount[i] > 1000 || (name[i]==name[j] && city[i]!=city[j] && abs(tm[j] - tm[i]) <= 60)) break;
if(j!=N) res.push_back(in[i]);
}
return res;
}
};
Current time: 2024年03月29日07時48分06秒
Last modified: 2019年08月30日07時51分29秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る
Logged in as: unknown user (not login)