結果

問題 No.1737 One to N
ユーザー distortedibudistortedibu
提出日時 2021-11-12 22:39:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 306 bytes
コンパイル時間 1,295 ms
コンパイル使用メモリ 166,312 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-25 20:12:52
合計ジャッジ時間 2,104 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N = 0;
  cin >> N;
  int X =1;
  int ans = 0;
  int K =0;
  int i = 2;

  while (i <= N && N != 1){
      if (N % i == 0){
          N = N / i;
          ans = ans + i;
      }
      
      else{
          i++;
      }
  }
  cout << ans;
}
0