結果

問題 No.294 SuperFizzBuzz
ユーザー akakimidoriakakimidori
提出日時 2017-05-07 01:08:51
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 655 bytes
コンパイル時間 1,226 ms
コンパイル使用メモリ 25,192 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 15:18:49
合計ジャッジ時間 2,745 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 0 ms
4,348 KB
testcase_02 AC 124 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,356 KB
testcase_08 AC 7 ms
4,348 KB
testcase_09 AC 71 ms
4,352 KB
testcase_10 AC 70 ms
4,352 KB
testcase_11 AC 115 ms
4,348 KB
testcase_12 AC 120 ms
4,352 KB
testcase_13 AC 122 ms
4,348 KB
testcase_14 AC 125 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

int popCount(int n){
  int t=(n&0x55555555)+((n>>1)&0x55555555);
  t=(t&0x33333333)+((t>>2)&0x33333333);
  t=(t&0x0F0F0F0F)+((t>>4)&0x0F0F0F0F);
  t=(t&0x00FF00FF)+((t>>8)&0x00FF00FF);
  t=(t&0x0000FFFF)+((t>>16)&0x0000FFFF);
  return t;
}

void run(void){
  int n;
  scanf("%d",&n);
  int i,j;
  for(i=3;i<=25;i++){
    for(j=0;j<(1<<(i-1));j++){
      n-=(__builtin_popcount(j)%3==2);
      if(n==0){
        int k=i-2;
        while(k>=0){
          printf("%d",(j>>k)&0x01?5:3);
          k--;
        }
        printf("5\n");
        return;
      }
    }
  }
  return;
}

int main(void){
  run();
  return 0;
}
0