Submission

Status:

---------

Subtask/Task Score:

0/100

Score: 0

User: KanemiyaKana

Problemset: บวกเลขฐาน

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-02 16:38:35

#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
    int total = 0;

    string input;
    getline(cin, input);
    stringstream ss1(input);
    int value1 = 0;
    int output = 0;
    int firstline[10];
    int count1 = 0;

    while (ss1 >> value1)
    {
        count1++;
        if (count1 > 10)
        {
            cout << "Wrong format, please make sure there are exactly 10 numbers on each line.";
            return 0;
        }
        firstline[count1 - 1] = value1;
    }
    if (count1 < 10)
    {
        cout << "Wrong format, please make sure there are exactly 10 numbers on each line.";
        return 0;
    }

    string input2;
    getline(cin, input2);
    stringstream ss2(input2);
    int value2 = 0;
    int secondline[10];
    int count2 = 0;

    while (ss2 >> value2)
    {
        count2++;
        if (count2 > 10)
        {
            cout << "Wrong format, please make sure there are exactly 10 numbers on each line.";
            return 0;
        }
        secondline[count2 - 1] = value2;
    }
    if (count2 < 10)
    {
        cout << "Wrong format, please make sure there are exactly 10 numbers on each line.";
        return 0;
    }

    int all[20];
    for (int i = 0; i < 10; i++)
    {
        all[i] = firstline[i];
        all[i+10] = secondline[i];
    }
    for (int i = 1; i < 20; i = i + 2)
    {
        total = total + all[i];
    }
    cout << total;
}