結果
問題 | No.2880 Max Sigma Mod |
ユーザー |
![]() |
提出日時 | 2024-09-09 15:42:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 3,000 ms |
コード長 | 660 bytes |
コンパイル時間 | 380 ms |
コンパイル使用メモリ | 41,344 KB |
最終ジャッジ日時 | 2025-02-24 06:19:13 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 48 |
コンパイルメッセージ
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%d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 2880.cc: No.2880 Max Sigma Mod - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 200000; const int MAX_M = 200000; /* typedef */ using ll = long long; /* global variables */ ll ds[MAX_N + 1], ss[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n, m; scanf("%d%d", &n, &m); for (int x = 1; x <= n; x++) ds[x] = m; for (int i = 1; i <= m; i++) for (int x = i; x <= n; x += i) ds[x] -= i; for (int x = 1; x <= n; x++) ss[x] = ss[x - 1] + ds[x]; ll maxs = *max_element(ss + 1, ss + n + 1); printf("%lld\n", maxs); return 0; }