結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー |
![]() |
提出日時 | 2014-12-24 00:14:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 772 bytes |
コンパイル時間 | 593 ms |
コンパイル使用メモリ | 70,880 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-12 04:51:24 |
合計ジャッジ時間 | 1,378 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%d",&in[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <cstdio> #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> using namespace std; int main(){ int n,in[50],max_n=0,min_n=1000000000,ansa=0,ansb=0; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%d",&in[i]); max_n=max(max_n,in[i]); min_n=min(min_n,in[i]); } if(max_n==min_n){ if(max_n+4==n*4) printf("%d %d\n",0,n); else printf("%d %d\n",n,0); }else{ for(int i=0;i<n;i++){ if(in[i]==max_n) ansa++; else ansb++; } printf("%d %d\n",ansa,ansb); } return 0; }