結果
| 問題 | 
                            No.888 約数の総和
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ate
                         | 
                    
| 提出日時 | 2019-11-06 14:36:06 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 33 ms / 2,000 ms | 
| コード長 | 554 bytes | 
| コンパイル時間 | 2,135 ms | 
| コンパイル使用メモリ | 199,324 KB | 
| 最終ジャッジ日時 | 2025-01-08 02:22:04 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    6 | main(){
      | ^~~~
            
            ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);++i)
main(){
  ll n;
  cin>>n;
  auto div = [](ll n){
    vector<ll> div;
    for(ll p=1;p*p<=n;++p){
      if(n%p==0){
        div.emplace_back(p);
        if(p*p!=n)div.emplace_back(n/p);
      }
    }
    sort(div.begin(),div.end());
    return div;
  };
  auto vsum = [](vector<ll> const& v){
    ll sum = 0;
    for(auto const& value:v){
      sum += value;
    }
    return sum;
  };
  auto d = div(n);
  ll s = vsum(d);
  cout<<(s)<<endl;
}
            
            
            
        
            
ate