結果
問題 | No.358 も~っと!門松列 |
ユーザー |
![]() |
提出日時 | 2017-07-18 20:02:32 |
言語 | C++11 (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 508 bytes |
コンパイル時間 | 409 ms |
コンパイル使用メモリ | 36,556 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-08 10:57:26 |
合計ジャッジ時間 | 1,278 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 8 |
コンパイルメッセージ
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[1]==1){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);}