結果
| 問題 | No.3474 Concat Decimal |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2026-03-24 12:51:38 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 717 bytes |
| 記録 | |
| コンパイル時間 | 442 ms |
| コンパイル使用メモリ | 56,656 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-03-24 12:51:47 |
| 合計ジャッジ時間 | 2,753 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 27 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3474.cc: No.3474 Concat Decimal - yukicoder
*/
#include<cstdio>
#include<algorithm>
#include<numeric>
using namespace std;
/* constant */
const int MAX_N = 200000;
/* typedef */
using ll = long long;
/* global variables */
int as[MAX_N];
/* subroutines */
/* main */
int main() {
int tn;
scanf("%d", &tn);
while (tn--) {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", as + i);
ll x = 1;
for (int i = 1; i < n; i++) {
ll a = as[i];
while (a > 0 && a % 10 == 0) a /= 10;
ll t = 1;
while (t <= a) t *= 10;
ll g = gcd(a, t);
x = lcm(x, t / g);
}
printf("%lld\n", x);
}
return 0;
}
tnakao0123