結果
| 問題 |
No.407 鴨等素数間隔列の数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-05 23:12:18 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,364 bytes |
| コンパイル時間 | 3,935 ms |
| コンパイル使用メモリ | 103,552 KB |
| 実行使用メモリ | 25,216 KB |
| 最終ジャッジ日時 | 2024-11-07 01:11:58 |
| 合計ジャッジ時間 | 7,550 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 -- * 4 |
| other | -- * 31 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace yuki_407
{
class Program
{
static void Main(string[] args)
{
var k = new List<int>();
long ans = 0;
int max = 10000000 / 2;
var z = new int[max];
k.Add(2);
for (int i = 3; i < max;i+=2)
{
bool t = true;
for (int j = 3; j*j <=i; j++)
{
if (i%j==0)
{
t = false;
break;
}
}
if (t)
{
k.Add(i);
}
}
var a = scan();
foreach (var i in k)
{
if (i*(a[0]-1)>a[1])
{
break;
}
else
{
int m = i * (a[0] - 1);
ans += a[1] - m + 1;
}
}
Console.WriteLine(ans);
}
static int[] scan()
{
return
Array.ConvertAll
(Console.ReadLine().Split(' '), int.Parse);
}
}
}