結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2016-11-09 14:04:56 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 560 bytes |
コンパイル時間 | 150 ms |
コンパイル使用メモリ | 20,736 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-25 05:50:27 |
合計ジャッジ時間 | 1,083 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 28 |
コンパイルメッセージ
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; }