結果

問題 No.420 mod2漸化式
ユーザー akakimidori
提出日時 2016-12-10 21:28:31
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 400 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 20,992 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 13:06:30
合計ジャッジ時間 1,228 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:16:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |   scanf("%d",&x);
      |   ^~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

typedef long long int ln;

ln comb(int n,int k){
  ln res=1;
  int i;
  for(i=1;i<=k;i++){
    res=res*(n+1-i)/i;
  }
  return res;
}

void run(void){
  int x;
  scanf("%d",&x);
  if(x>=32){
    printf("0 0\n");
  } else if(x==0){
    printf("1 0\n");
  } else {
    printf("%lld %lld\n",comb(31,x),comb(30,x-1)*2147483647);
  }
  return;
}

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