結果
| 問題 |
No.736 約比
|
| コンテスト | |
| ユーザー |
aaa
|
| 提出日時 | 2018-10-08 19:50:10 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 964 bytes |
| コンパイル時間 | 843 ms |
| コンパイル使用メモリ | 98,700 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-12 15:37:35 |
| 合計ジャッジ時間 | 2,490 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 58 |
ソースコード
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
using namespace std;
int func(int a, int b) {
//cout << "a->" << a << " " << "b->" << b << endl;
if (b > a)swap(a, b);
if (a%b == 0) {
return b;
}
else {
return func(b, a%b);
}
//return 0;
}
int main(){
int i, j, k;
int a, b, n;
vector<int>list;
cin >> n;
for (i = 0; i < n; i++) {
int num;
cin >> num;
list.push_back(num);
}
int num = func(list[0], list[1]);
if (n >= 3) {
for (i = 2; i < n; i++) {
num = func(list[i], num);
}
}
for (i = 0; i < n; i++) {
cout << list[i] / num;
if (i != n - 1) {
cout << ":";
}
}
cout << endl;
getchar();
getchar();
return 0;
}
aaa