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:51
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
int main()
{
int value = 0;
int count = 0;
int all[5];
string input;
getline(cin, input);
stringstream ss(input);
while (ss >> value)
{
count++;
if(count > 5)
{
cout << "Wrong format, please make sure there are exactly 5 numbers on each line.";
return 0;
}
all[count - 1] = value;
}
if (count < 5)
{
cout << "Wrong format, please make sure there are exactly 5 numbers on each line.";
return 0;
}
for (int i= 0; i < 5; i++)
{
if (all[i] > 50 || all[i] < 1)
{
cout << "Please make sure the amount limiter is within the 1 - 50 parameter.";
return 0;
}
}
for (int i= 0; i < 5; i++)
{
cout << all[i];
cout << " ";
for (int j = 0; j < all[i]; j++)
{
cout << "*";
}
if (i != 4)
{
cout << "\n";
}
}
}