結果
| 問題 | 
                            No.358 も~っと!門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lam6er
                         | 
                    
| 提出日時 | 2025-03-20 18:44:18 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 1,000 ms | 
| コード長 | 406 bytes | 
| コンパイル時間 | 222 ms | 
| コンパイル使用メモリ | 40,932 KB | 
| 実行使用メモリ | 7,324 KB | 
| 最終ジャッジ日時 | 2025-03-20 18:44:19 | 
| 合計ジャッジ時間 | 1,286 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |   int a,b,c,cnt=0; scanf("%d %d %d",&a,&b,&c);
      |                    ~~~~~^~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include<cstdio>
#include<algorithm> 
using namespace std;
int main() {
  //freopen("mod.in","r",stdin);
  //freopen("mod.out","w",stdout);
  int a,b,c,cnt=0; scanf("%d %d %d",&a,&b,&c);
  if(((a<b&&c<b)||(a>b&&c>b))&&a!=c) return printf("INF"),0;
  for(int i=1;i<=max({a,b,c});i++) {
  	int b1=a%i,b2=b%i,b3=c%i;
  	if(((b1<b2&&b3<b2)||(b1>b2&&b3>b2))&&b1!=b3) cnt++;
  }
  printf("%d",cnt);
  return 0;
}
            
            
            
        
            
lam6er