結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
![]() |
提出日時 | 2015-11-06 15:49:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 343 bytes |
コンパイル時間 | 455 ms |
コンパイル使用メモリ | 57,856 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 08:01:13 |
合計ジャッジ時間 | 1,486 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 17 |
コンパイルメッセージ
In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from main.cpp:1: In function ‘const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]’, inlined from ‘int main()’ at main.cpp:15:20: /usr/include/c++/13/bits/stl_algobase.h:238:7: warning: ‘d’ may be used uninitialized [-Wmaybe-uninitialized] 238 | if (__b < __a) | ^~ main.cpp: In function ‘int main()’: main.cpp:9:9: note: ‘d’ was declared here 9 | int d,d_max=INT_MAX; | ^
ソースコード
#include<iostream> #include<climits> #include<cstdlib> using namespace std; int main(){ int n; cin >> n; int x[n]; int d,d_max=INT_MAX; cin >> x[0]; for(int i=1;i<n;i++){ cin >> x[i]; if(x[i]!=x[i-1])d = x[i]-x[i-1]; if(d<0)d*=-1; d_max = min(d,d_max); } cout << d_max <<endl; }