結果

問題 No.237 作図可能性
ユーザー hadrori
提出日時 2015-07-26 23:14:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 1,383 ms
コンパイル使用メモリ 158,372 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 00:19:48
合計ジャッジ時間 2,145 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int fm[] = {3,5,17,257,65537};

int n;

int solve() {
    int ans = -2;
    for (int i = 1; i <= n; i<<=1) {
        for (int j = 0; j < 1<<5; j++) {
            i64 f = i;
            for (int k = 0; k < 5; k++) if(j>>k&1) f *= fm[k];
            if(f <= n) ans++;
        }
    }
    return ans;
}

int main() {
    scanf("%d", &n);
    printf("%d\n", solve());
    return 0;
}
0