結果
| 問題 |
No.2940 Sigma Sigma Div Floor Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-10 21:18:15 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 6,000 ms |
| コード長 | 947 bytes |
| コンパイル時間 | 10,211 ms |
| コンパイル使用メモリ | 167,296 KB |
| 実行使用メモリ | 30,080 KB |
| 最終ジャッジ日時 | 2024-11-10 21:18:30 |
| 合計ジャッジ時間 | 10,596 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 WA * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (125 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
static int NN => int.Parse(ReadLine());
static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
static string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
public static void Main()
{
Solve();
}
static void Solve()
{
var n = long.Parse(ReadLine());
if (n > 1_200_000) return;
var ans = 0L;
var mod = 998_244_353;
for (var j = 1; j <= n; ++j)
{
var cnt = n - j + 1;
var max = (cnt + j - 1) / j;
var maxcnt = (cnt + j - 1) % j + 1;
ans = (ans +
max * (max + 1) / 2 % mod * maxcnt % mod +
max * (max - 1) / 2 % mod * (j - maxcnt) % mod) % mod;
}
WriteLine(ans);
}
}