結果

問題 No.888 約数の総和
ユーザー mmn15277198
提出日時 2020-07-05 18:44:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 431 bytes
コンパイル時間 879 ms
コンパイル使用メモリ 79,136 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 17:20:31
合計ジャッジ時間 1,991 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <math.h>
#include <map>
using namespace std;

long long yakusu_sum(long long x){
	if(x==1){
		return 1;
	}
	long long sum=0;
	for(long long i=1;i*i<=x;i++){
		if(x%i==0){
			sum+=i;
			if(x/i==i)continue;
			sum+=x/i;
		}
	}
	return sum;
}

int main(){
	long long n;
	cin >> n;
	cout << yakusu_sum(n) << endl;
	return 0;
}
0