結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2016-11-09 14:05:38 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 562 bytes |
| 記録 | |
| コンパイル時間 | 135 ms |
| コンパイル使用メモリ | 20,608 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-25 05:50:33 |
| 合計ジャッジ時間 | 1,015 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 2 |
| other | AC * 17 WA * 11 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:28:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | scanf("%d%d%d", &s[0], &s[1], &s[2]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
void swap(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
void sort(int *s)
{
if(s[0] > s[1]){
swap(&s[0], &s[1]);
}
if(s[1] > s[2]){
swap(&s[1], &s[2]);
}
if(s[0] > s[1]){
swap(&s[0], &s[1]);
}
}
int main(void) {
int i;
int a = 0;
int s[3];
scanf("%d%d%d", &s[0], &s[1], &s[2]);
sort(s);
//printf("%d %d %d:%d\n", s[0], s[1], s[2], a);
if(s[1] == s[2]){
printf("%d\n", s[1] / 2 / 2 + s[1] / 2 / 2 + s[0]);
}
else{
printf("%d\n", (s[1] - s[0]) / 2 + (s[2] - s[1]) / 2 / 2 + s[0]);
}
return 0;
}
suppy193