結果

問題 No.294 SuperFizzBuzz
ユーザー akakimidoriakakimidori
提出日時 2017-05-06 15:43:25
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 645 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 25,044 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 15:07:07
合計ジャッジ時間 1,706 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,348 KB
testcase_01 AC 0 ms
4,352 KB
testcase_02 AC 131 ms
4,348 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 0 ms
4,348 KB
testcase_08 AC 8 ms
4,348 KB
testcase_09 AC 73 ms
4,352 KB
testcase_10 AC 74 ms
4,348 KB
testcase_11 AC 123 ms
4,352 KB
testcase_12 AC 125 ms
4,348 KB
testcase_13 AC 128 ms
4,352 KB
testcase_14 AC 131 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-=(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