結果
| 問題 | No.3388 Sum of Function |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-09 21:47:35 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| コード長 | 621 bytes |
| 記録 | |
| コンパイル時間 | 7,631 ms |
| コンパイル使用メモリ | 169,784 KB |
| 実行使用メモリ | 187,944 KB |
| 最終ジャッジ日時 | 2025-12-09 21:47:46 |
| 合計ジャッジ時間 | 10,731 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (107 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
class Program
{
static bool IsPrime(int n)
{
if (n < 2) return false;
for (int i = 2; i * i <= n; i++)
if (n % i == 0) return false;
return true;
}
static void Main()
{
var inp = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
int A = inp[0], B = inp[1];
long sum = 0;
for (int x = A; x <= B; x++)
{
if (IsPrime(x))
{
long fx = (long)x * x * x - (long)x * x + x + 1;
sum += fx;
}
}
Console.WriteLine(sum);
}
}