結果
問題 | No.420 mod2漸化式 |
ユーザー |
![]() |
提出日時 | 2017-07-26 20:00:54 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 419 bytes |
コンパイル時間 | 1,413 ms |
コンパイル使用メモリ | 157,420 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 17:53:19 |
合計ジャッジ時間 | 2,260 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 35 |
コンパイルメッセージ
main.cpp:6:2: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 6 | }main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d",&N); | ~~~~~^~~~~~~~~
ソースコード
#include<bits/stdc++.h>long long combi(int n, int r){long long p = 1;for(int i = 1;i <= r;i++) p = p*(n-i+1)/i;return p;}main(){long long sum = 0;int N;scanf("%d",&N);if(!N)printf("1 0\n");else if(N >= 32)printf("0 0\n");else{for(int i = 0;i < 31;i++){sum += (1 << i) * combi(30,N-1);}printf("%lld %lld\n",combi(31,N),sum);}}