結果
| 問題 |
No.1934 Four Fruits
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2022-05-13 22:40:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 615 bytes |
| コンパイル時間 | 444 ms |
| コンパイル使用メモリ | 44,360 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-22 02:49:46 |
| 合計ジャッジ時間 | 1,068 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:37:9: warning: 'x' may be used uninitialized [-Wmaybe-uninitialized]
37 | printf("%d\n", x);
| ~~~~~~^~~~~~~~~~~
main.cpp:27:7: note: 'x' was declared here
27 | int x;
| ^
ソースコード
/* -*- coding: utf-8 -*-
*
* 1934.cc: No.1934 Four Fruits - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
/* typedef */
/* global variables */
int as[3], cs[4];
/* subroutines */
/* main */
int main() {
for (int i = 0; i < 3; i++) scanf("%d", as + i);
sort(as, as + 3);
int x;
if (as[0] == as[2]) x = as[0];
else if (as[0] == as[1]) x = as[2];
else if (as[1] == as[2]) x = as[0];
else {
for (int i = 0; i < 3; i++) cs[as[i]] = 1;
for (int i = 0; i < 4; i++)
if (cs[i] == 0) { x = i; break; }
}
printf("%d\n", x);
return 0;
}
tnakao0123