結果
問題 |
No.2940 Sigma Sigma Div Floor Problem
|
ユーザー |
![]() |
提出日時 | 2024-10-20 23:05:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 43 ms / 6,000 ms |
コード長 | 628 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 40,192 KB |
最終ジャッジ日時 | 2025-02-24 22:04:07 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 RE * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:30:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 30 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 2940.cc: No.2940 Sigma Sigma Div Floor Problem - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 1200000; const int MOD = 998244353; /* typedef */ using ll = long long; /* global variables */ int cs[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 1; i <= n; i++) for (int j = i; j <= n; j += i) cs[j]++; for (int i = 1; i <= n; i++) cs[i] += cs[i - 1]; int sum = 0; for (int i = 1; i <= n; i++) sum = (sum + cs[i]) % MOD; printf("%d\n", sum); return 0; }