結果

問題 No.799 赤黒かーどげぇむ
ユーザー devxsssdevxsss
提出日時 2019-03-19 18:09:55
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 52,076 KB
実行使用メモリ 8,744 KB
最終ジャッジ日時 2023-10-12 02:47:39
合計ジャッジ時間 5,814 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,744 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 WA -
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0