結果
| 問題 | No.933 おまわりさんこいつです |
| コンテスト | |
| ユーザー |
shop_one
|
| 提出日時 | 2019-11-29 21:48:07 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 86 ms / 2,000 ms |
| コード長 | 542 bytes |
| 記録 | |
| コンパイル時間 | 650 ms |
| コンパイル使用メモリ | 86,484 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-15 03:02:23 |
| 合計ジャッジ時間 | 2,462 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:2:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
inlined from 'int main()' at main.cpp:36:11:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:212:25: warning: 'v' may be used uninitialized [-Wmaybe-uninitialized]
212 | { return _M_insert(__n); }
| ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:19:8: note: 'v' was declared here
19 | ll n,v;
| ^
ソースコード
// I SELL YOU...!
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll val(ll n){
ll res=0;
while(n>0){
res += n%10;
n/=10;
}
return res;
}
signed main(){
ll n,v;
cin >> n;
ll p[n];
for(int i=0;i<n;i++){
cin >> p[i];
if(i==0){
v = p[i];
while(v>=10){
v = val(v);
}
}else{
v *= p[i];
while(v>=10){
v = val(v);
}
}
}
cout << v << endl;
}
shop_one