結果
問題 |
No.888 約数の総和
|
ユーザー |
![]() |
提出日時 | 2024-09-27 11:19:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 748 bytes |
コンパイル時間 | 1,893 ms |
コンパイル使用メモリ | 193,624 KB |
最終ジャッジ日時 | 2025-02-24 13:01:42 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘void fast()’: main.cpp:17:20: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | freopen(taskname".inp","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:18:20: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | freopen(taskname".out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define fi first #define se second #define ll long long #define ull unsigned long long #define mp make_pair #define pb push_back #define sz size #define for(i, a, b) for (int i = (a); i <= (b); i++) const int N = 1e5, INF = 1e9, MOD = 1e7; using namespace std; void fast() { #define taskname "test1" if(fopen(taskname".inp","r")) { freopen(taskname".inp","r",stdin); freopen(taskname".out","w",stdout); } cin.tie(0)->sync_with_stdio(0); } int main() { fast(); ll n,tonguoc=0; cin>>n; for(i,1,sqrt(n)){ if(n%i==0) { tonguoc+=i; if(n/i!=i) tonguoc+=n/i; } } cout<<tonguoc; return 0; }