結果
問題 | No.637 X: Yet Another FizzBuzz Problem |
ユーザー |
|
提出日時 | 2024-04-06 17:37:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 687 bytes |
コンパイル時間 | 1,751 ms |
コンパイル使用メモリ | 171,132 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-01 03:55:56 |
合計ジャッジ時間 | 2,358 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
外部呼び出し有り |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using vll=vector<long long>; template<typename T>T get(){T r;cin>>r;return r;} template<typename T>vector<T> get_v(ll n){vector<T> v;for(int i=0;i!=n;i++){v.push_back(get<T>());};return v;} template<typename T>void show_v(vector<T> v){for(auto &i:v){cout<<i<<" ";}cout<<""<<endl;} ll digit(ll n){ if (n<=2) return 1; return (ll)log10(n)+1; } int main() { vll a=get_v<ll>(5); ll sum=0; for(auto &i:a){ if(i%15==0){ sum+=8; }else if(i%5==0||i%3==0){ sum+=4; }else{ sum+=digit(i); } } cout<<sum<<endl; system("pause"); }