結果
問題 |
No.609 Noelちゃんと星々
|
ユーザー |
![]() |
提出日時 | 2018-01-30 10:14:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 567 bytes |
コンパイル時間 | 525 ms |
コンパイル使用メモリ | 66,636 KB |
最終ジャッジ日時 | 2025-01-05 08:03:10 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 10 TLE * 15 |
ソースコード
#include<iostream> using namespace std; class ten{ int ans, tmp; int N; int i,j; int n[1000000]; public: ten(); void cal(); void show(); }; ten::ten() { cin >> N; for(i = 0; i < N; i++){ cin >> n[i]; } } void ten::cal() { for(i = 0; i < N; i++){ for(j = 0; j < N; j++){ tmp += n[i] - n[j]; } if(tmp < 0){ tmp = -1 * tmp; } if(i == 0) ans = tmp; if(tmp < ans){ ans = tmp; } } } void ten::show() { cout << ans << "\n"; } int main() { ten ob; ob.cal(); ob.show(); return 0; }