結果
問題 |
No.888 約数の総和
|
ユーザー |
|
提出日時 | 2019-09-27 14:41:06 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 552 bytes |
コンパイル時間 | 615 ms |
コンパイル使用メモリ | 61,808 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 06:54:03 |
合計ジャッジ時間 | 1,541 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 30 |
ソースコード
#include <cstdio> #include <cmath> #include <iostream> #define rep( i, n, m ) for (int i = ( n ); i < ( m ); i++) #define rep_d( i, n, m ) for (int i = ( n ); i < ( m ); i--) typedef unsigned long long lint; int main( void ){ lint n; std::cin >> n; if (n == 1){ printf( "1\n" ); return 0; } lint sum = 1 + n; lint max = std::sqrt( n ) + 1; lint a; for(lint i = 2; i < max; i++){ a = ( lint )( n / i ); if (n - i * a == 0){ sum += i + a; if (i == max - 1) sum -= max - 1; } } std::cout << sum << std::endl; return 0; }