出题人题解

admin 2024-10-20 21:30:44

F. 不是质数电脑!

题目要意:你需要将某个数组的所有数对114取模后求和

签到题之一,由于题目放在中间,通过人数低于预期

按照题意模拟即可,时间复杂度

#include <bits/stdc++.h>
using namespace std;
void solve() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int tp;
        cin >> tp;
        tp %= 114;
        ans += tp;
    }
    cout << ans << endl;
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int __ = 1;
    std::cin >> __;
    while (__--) {
        solve();
    }
    return 0;
}