#include #include #include using namespace std; int parseInt() { string line; getline(std::cin, line); size_t parsed; int const S = stoi(line, &parsed); if (parsed != line.size()) { cout << "Malformed integer input: " << line << endl; exit(1); } return S; } typedef unsigned long long NumberPart; /* 0~2^64-1 */ typedef unsigned char Digit; /* 0~255 */ void accumulate(vector &digits, NumberPart part) { // Add each digit from part to digits using division by 10 size_t di = 0; bool carry = 0; while (part or carry) { while (di >= digits.size()) { digits.push_back(0); } Digit const sum = digits[di] + (part % 10) + carry; carry = sum / 10; digits[di] = sum % 10; di++; part /= 10; } } int main() { int a, b; string s; // 標準入力から、空白や改行で区切られた整数と文字列を読み込む。 cin >> a >> b >> s; // 整数と文字列を空白で区切って、標準出力に書き出す。 cout << a + b << " " << s << endl; cout << "Hello World!\n"; int N; std::cin >> N; int ans=0; for(int i=N;i>0;i--) ans+=i; std::cout << ans << std::endl; int A; int B; char str[10]; cin >> A; cin >> B; cin >> str; cout << A + B << " " << str << endl; int n; cin >> n; for (int i = 1; i <= n; i++) { if (i % 3 == 0) { if (i % 5 == 0) { cout << "FizzBuzz" << endl; } else { cout << "Fizz" << endl; } } else if (i % 5 == 0) { cout << "Buzz" << endl; } else{ cout << i<< endl; } } int const S = parseInt(); vector digits = { 0 }; for (int i = 0; i < N; ++i) { NumberPart part; cin >> part; accumulate(digits, part); } for (int i = digits.size() - 1; i >= 0; --i) { cout << to_string(digits[i]); } cout << endl; return 0; }