結果
問題 |
No.799 赤黒かーどげぇむ
|
ユーザー |
|
提出日時 | 2019-03-19 17:46:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 622 bytes |
コンパイル時間 | 525 ms |
コンパイル使用メモリ | 54,612 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-09-14 01:49:34 |
合計ジャッジ時間 | 4,629 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 7 RE * 4 TLE * 1 -- * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d %d %d %d",&n,&r,&n2,&r2); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <iostream> #include <stdio.h> using namespace std; int factorial(int n){ int i; if(n==1) return n=1; else n*=factorial(n-1); return n; } int main() { int n,r,n2,r2,result,result2; scanf("%d %d %d %d",&n,&r,&n2,&r2); int b1=r-n+1; int b2=r2-n2+1; result=factorial(b1)/(factorial(1)*factorial(b1-1)); result2=factorial(b2)/(factorial(1)*factorial(b2-1)); int total=result*result2; int beda=(r2-n); int beda2=r-n2; if(beda<0) beda*=-1; if(beda2<0) beda2*=-1; int sama=beda2-beda; if(sama<0) sama*=-1; cout<<total-sama; return 0; }