結果
| 問題 | 
                            No.799 赤黒かーどげぇむ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-03-19 19:30:01 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 359 bytes | 
| コンパイル時間 | 532 ms | 
| コンパイル使用メモリ | 53,848 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-14 04:49:33 | 
| 合計ジャッジ時間 | 1,386 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 WA * 9 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d %d %d %d",&n,&r,&n2,&r2);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{   int n,r,n2,r2,result,result2;
    scanf("%d %d %d %d",&n,&r,&n2,&r2);
    int s=r-n+1;
    int k=r2-n2+1;
    int ma=max(n,n2);
    int mi=min(r,r2);
    int tot=ma-mi;
    if(tot>0){
    cout<<s*k<<endl;
    }
    else{
        cout<<s*k-(tot+1)<<endl;
    }
    
    return 0;
}