結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
Cooh
|
| 提出日時 | 2019-06-02 01:20:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 720 bytes |
| コンパイル時間 | 589 ms |
| コンパイル使用メモリ | 62,212 KB |
| 実行使用メモリ | 13,756 KB |
| 最終ジャッジ日時 | 2024-09-17 20:02:38 |
| 合計ジャッジ時間 | 4,171 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 12 TLE * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:45:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
45 | system("pause");
| ~~~~~~^~~~~~~~~
ソースコード
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int Enjapma(int A, int B) {
if (A == B) {
return -1;
}
int D = A + B;
vector<int> div;
for (int i = 1; i < (D / 2); i++) {
if (D%i == 0) {
div.insert(div.begin(), i);
}
}
vector<int> Bans;
vector<int>::iterator a = div.begin();
while (a != div.end()) {
if ((A + *a) % B == 0) {
Bans.insert(Bans.begin(), *a);
}
a++;
}
int ans = -1;
vector<int>::iterator b = Bans.begin();
while (b != Bans.end()) {
if ((B + *b) % A == 0) {
ans = *b;
}
b++;
}
return ans;
}
int main() {
int A, B;
cout << "A > "; cin >> A;
cout << "B > "; cin >> B;
cout << Enjapma(A, B) << endl;
system("pause");
return 0;
}
Cooh