結果
| 問題 | 
                            No.358 も~っと!門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Bantako
                         | 
                    
| 提出日時 | 2017-07-18 20:07:51 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 749 bytes | 
| コンパイル時間 | 455 ms | 
| コンパイル使用メモリ | 36,816 KB | 
| 実行使用メモリ | 6,816 KB | 
| 最終ジャッジ日時 | 2024-10-08 10:58:06 | 
| 合計ジャッジ時間 | 1,063 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 21 WA * 2 | 
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d%d%d",&A[0],&A[1],&A[2]);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include<stdio.h>
#include<algorithm>
using namespace std;
main(){
    int A[3];
    scanf("%d%d%d",&A[0],&A[1],&A[2]);
    if(A[0]==A[1] && A[1]==A[2] && A[2]==A[0]){
        printf("0\n");
        return 0;
    }
    if(A[1]==1 && A[0]!=1 && A[2]!=1){
        printf("INF\n");
        return 0;
    }
    if((A[1] > A[0] && A[1] > A[2])||
        A[1] < A[0] && A[1] < A[2]){
        printf("INF\n");
        return 0;
    }
    int count = 0;
    for(int i = 2;i <= 1001;i++){
        int B[3];
        for(int j = 0;j < 3;j++){
            B[j] = A[j] % i;
        }
        sort(B,B+3);
        if(B[0]!=B[1] && B[1]!=B[2] && B[2]!=B[0])
        if(B[0]==A[1]%i || B[2]==A[1]%i){
            count++;
        }
    }
    printf("%d\n",count);
}
            
            
            
        
            
Bantako