re求助

B4004 [GESP202406 三级] 寻找倍数

> $1 \le n \le 10^5$
by 123456ph @ 2024-07-09 19:00:10


> `int a[10011];` 应为 > `int a[100011]`
by 123456ph @ 2024-07-09 19:00:52


@[Binary_Tree_](/user/1034295) 首先吐槽一句,你这码风让我看的头疼。 据@[123456ph](/user/837490) 所说的一样,应该把数组开大,但是只解决了RE的问题,只能获得 $65$ pts。 30行: ```cpp int a[10011]; ``` 改成 ```cpp int a[100011]; ``` ------------ 40行: ```cpp tt = max(a[i], maxn); ``` 改成 ```cpp tt = max(a[i], tt); ``` 也不知道你这个 maxn 是从哪里冒出来的,反正没用,应该是 tt。
by MhxMa @ 2024-07-09 19:08:24


@[MhxMa](/user/857786) sorry。可能我的审美有问题。 请问怎样的码风看起来舒适一点
by Binary_Tree_ @ 2024-07-09 19:10:57


@[123456ph](/user/837490) @[MhxMa](/user/857786) thx
by Binary_Tree_ @ 2024-07-09 19:11:51


@[Binary_Tree_](/user/1034295) 你的变量命名有点问题,所以可能才会导致 65 pts 我也不太确定,其实这个影响可能不大,我写的也不好,但是可能要更偏向大众化,即变量格式规范,变量声明整齐,无多余内容(多余的函数、头文件等): 仅个人观点,勿喷 ``` #include <bits/stdc++.h> #define int long long using namespace std; int t, n, maxn; bool fl; int a[100005]; signed main() { std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> t; for (int i = 1; i <= t; i++) { cin >> n; maxn = -1e9, fl = 1; for (int j = 1; j <= n; j++) { cin >> a[j]; maxn = max(a[j], maxn); } for (int j = 1; j <= n; j++) { if (maxn % a[j] != 0) { fl = false; break; } } if (fl) { puts("Yes"); } else { puts("No"); } } return 0; } ```
by MhxMa @ 2024-07-09 19:18:08


@[MhxMa](/user/857786) o,学到了,我大多都是为了调试。 而头文件是省缺源
by Binary_Tree_ @ 2024-07-09 19:22:50


@[MhxMa](/user/857786) ~~壶关plz~~
by Binary_Tree_ @ 2024-07-09 19:23:06


@[Binary_Tree_](/user/1034295) ok
by MhxMa @ 2024-07-09 23:14:21


@[Binary_Tree_](/user/1034295) ~~你是不是关注过我~~
by MhxMa @ 2024-07-09 23:15:12


|