結果

問題 No.1059 素敵な集合
ユーザー 🍮かんプリン
提出日時 2020-05-22 22:32:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 535 bytes
コンパイル時間 1,130 ms
コンパイル使用メモリ 161,540 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-05 18:47:55
合計ジャッジ時間 1,804 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 2 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.05.22 22:32:51
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int L, R;
    cin >> L >> R;
    int ans = 0;
    vector<bool> v(R+1,false);
    for (int i = L; i < R; i++) {
        if (v[i]) continue;
        for (int j = i + i; j <= R; j+=i) {
            v[j] = true;
        }
    }
    for (int i = L + 1; i <= R; i++) {
        if (!v[i]) {
            ans++;  
        }
    }
    cout << ans << endl;
    return 0;
}
0