結果
| 問題 | No.637 X: Yet Another FizzBuzz Problem | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-05-10 20:36:57 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                CE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 919 bytes | 
| コンパイル時間 | 506 ms | 
| コンパイル使用メモリ | 79,540 KB | 
| 最終ジャッジ日時 | 2024-06-28 19:04:32 | 
| 合計ジャッジ時間 | 827 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:19: error: invalid ‘static_cast’ from type ‘std::__cxx11::basic_ostringstream<char>’ to type ‘std::ostringstream&’ {aka ‘std::__cxx11::basic_ostringstream<char>&’}
   20 | #define SSTR( x ) static_cast< std::ostringstream & >( \
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   21 |         ( std::ostringstream() << std::dec << x ) ).str()
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:38:20: note: in expansion of macro ‘SSTR’
   38 |         string s = SSTR(a[i]);
      |                    ^~~~
            
            ソースコード
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <complex>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <cassert>
#include <fstream>
#define REP(i,n) for(i=0;i<n;i++)
#define FOR(a,b) for(:a<b;a++)
#define SSTR( x ) static_cast< std::ostringstream & >( \
        ( std::ostringstream() << std::dec << x ) ).str()
using namespace std;
typedef long long unsigned int llu;
typedef long long ll;
int main (){
  int a[5];
  while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4]){
    int i,cnt = 0;
    REP(i,5){
      if(a[i] % 15 == 0){
	cnt += 8;
      }else if(a[i] % 3 == 0){
	cnt += 4;
      }else if(a[i] % 5 == 0){
	cnt += 4;
      }else{
	string s = SSTR(a[i]);
	cnt += s.length();
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
            
            
            
        