結果

問題 No.888 約数の総和
ユーザー vjudge1
提出日時 2024-09-25 23:55:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 1,794 ms
コンパイル使用メモリ 195,788 KB
最終ジャッジ日時 2025-02-24 12:40:23
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<int> A;
map<ll, ll> cnt;
bool checknt (int x) {
if (x<=1) return 0;
if (x==2) return 1;
else {
for (int i=2; i<=sqrt(x); i++) {
if (x%i==0) return 0;
}
return 1;
}
}
int main () {
ll n;
cin >> n;
ll ans=0;
for (int i=1; i<=sqrt(n); i++) {
        if (n%i==0 ) {
          ans+=i;
          if (n/i!=i) ans+=n/i;
        }
}
cout << ans << endl;
    return 0;
}
0