結果

問題 No.1322 Totient Bound
ユーザー chocoruskchocorusk
提出日時 2020-12-08 12:32:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,298 bytes
コンパイル時間 1,392 ms
コンパイル使用メモリ 128,964 KB
実行使用メモリ 43,992 KB
最終ジャッジ日時 2023-10-18 22:48:01
合計ジャッジ時間 34,983 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 380 ms
43,872 KB
testcase_01 AC 367 ms
43,872 KB
testcase_02 AC 378 ms
43,872 KB
testcase_03 AC 388 ms
43,872 KB
testcase_04 AC 391 ms
43,872 KB
testcase_05 AC 384 ms
43,872 KB
testcase_06 AC 404 ms
43,872 KB
testcase_07 AC 407 ms
43,872 KB
testcase_08 AC 413 ms
43,872 KB
testcase_09 AC 397 ms
43,872 KB
testcase_10 AC 382 ms
43,872 KB
testcase_11 AC 398 ms
43,872 KB
testcase_12 AC 396 ms
43,872 KB
testcase_13 AC 398 ms
43,872 KB
testcase_14 AC 403 ms
43,872 KB
testcase_15 AC 397 ms
43,872 KB
testcase_16 AC 459 ms
43,872 KB
testcase_17 AC 415 ms
43,872 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 399 ms
43,872 KB
testcase_31 AC 399 ms
43,872 KB
testcase_32 AC 390 ms
43,872 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int MAX=10000010;
bitset<MAX> isprime;
void sieve(){
    for(int i=3; i<MAX; i++, i++) isprime[i]=1;
    isprime[2]=1;
    for(int i=3; i<MAX; i++){
        if(isprime[i]){
            for(int j=(i<<1); j<MAX; j+=i) isprime[j]=0;
        }
    }
}
int phi[MAX];
void calc(){
    for(int i=1; i<MAX; i++) phi[i]=i;
    for(int i=2; i<MAX; i++){
        if(isprime[i]){
            for(int j=i; j<MAX; j+=i){
                phi[j]/=i;
                phi[j]*=(i-1);
            }
        }
    }
}
int main()
{
    sieve();calc();
    ll n; cin>>n;
    assert(n<=1000000);
    int ans=0;
    for(int i=1; i<MAX; i++){
        if(phi[i]<=n){
            //cout<<i<<endl;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}
0