QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#825011#9531. Weird CeilingccsurzwWA 1ms3544kbC++231.0kb2024-12-21 16:58:002024-12-21 16:58:00

Judging History

This is the latest submission verdict.

  • [2024-12-21 16:58:00]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3544kb
  • [2024-12-21 16:58:00]
  • Submitted

answer

#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
#define N 201000
#define endl '\n'
ll mod = 998244353;
ll qpow(ll x, ll y);
int n;
vector<ll> a;


void solve() {
    ll n;
    cin >> n;
    a.clear();
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            int sum = n / i;
            a.push_back(sum);
            if (sum != i)a.push_back(i);
        }
    }
    sort(a.begin(), a.end());
    ll ans = 1 ;
    for (int i = 0; i < a.size(); i++)cout << a[i] << ' ';
    for (int i = 0; i < a.size() - 1; i++) {
        ans += (a[i + 1] - a[i])* (n / a[i]);
    }
    cout << ans << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }

}

ll qpow(ll x, ll y) {
    ll sum = 1;
    while (y) {
        if (y & 1)sum = sum * x % mod;
        y >>= 1;
        x = x * x % mod;
    }
    return sum;
}


詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3544kb

input:

3
5
451
114514

output:

1 5 21
1 11 41 451 10251
1 2 31 62 1847 3694 57257 114514 7075858

result:

wrong answer 1st lines differ - expected: '21', found: '1 5 21'