Problem Link
#include <iostream>
using namespace std;
int main()
{
int n, t, dish;
long long maxDish;
cin >> t;
while(t--)
{
cin >> n;
maxDish = 0;
while(n--)
{
cin >> dish;
maxDish += (dish - 1);
}
cout << maxDish + 1 << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n, t, dish;
long long maxDish;
cin >> t;
while(t--)
{
cin >> n;
maxDish = 0;
while(n--)
{
cin >> dish;
maxDish += (dish - 1);
}
cout << maxDish + 1 << endl;
}
return 0;
}
Comments
Post a Comment