QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#765214 | #9255. Python Program | 1903331632 | WA | 0ms | 3876kb | C++23 | 2.2kb | 2024-11-20 13:09:11 | 2024-11-20 13:09:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(s) s.begin(), s.end()
// #define int long long
#define endl '\n'
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
int q;
vector<int> is_p;
bool is[N];
void solve()
{
string s;
cin >> s >> s >> s >> s >> s;
string t1, t2, t3;
int it1 = s.find("(");
int it2 = s.find(",");
int it3 = s.rfind(",");
t1 = s.substr(it1 + 1, it2 - it1 - 1);
if (it2 != it3)
{
t2 = s.substr(it2 + 1, it3 - it2 - 1);
t3 = s.substr(it3 + 1, s.find(")") - it3 - 1);
}
else
{
t2 = s.substr(it2 + 1, s.find(")") - it2 - 1);
t3 = "1";
}
cin >> s;
cin >> s;
string b = s;
cin >> s;
cin >> s;
string q1, q2, q3;
it1 = s.find("(");
it2 = s.find(",");
it3 = s.rfind(",");
q1 = s.substr(it1 + 1, it2 - it1 - 1);
if (it2 != it3)
{
q2 = s.substr(it2 + 1, it3 - it2 - 1);
q3 = s.substr(it3 + 1, s.find(")") - it3 - 1);
}
else
{
q2 = s.substr(it2 + 1, s.find(")") - it2 - 1);
q3 = "1";
}
cout << t1 << ' ' << t2 << ' ' << t3 << endl;
cout << b << endl;
cout << q1 << ' ' << q2 << ' ' << q3 << endl;
cin >> s;
char o = s[5];
cin >> s;
int x1 = stoi(t1), x2 = stoi(t2), x3 = stoi(t3);
int res = 0;
for (int i = x1; ((x3 > 0) ? (i < x2) : (i > x2)); i += x3)
{
int y1 = (isalpha(q1[0]) ? (i) : (stoi(q1)));
int y2 = (isalpha(q2[0]) ? (i) : (stoi(q2)));
int y3 = (isalpha(q3[0]) ? (i) : (stoi(q3)));
if (y3 > 0)
{
if (y1 < y2)
{
int k = (y2 - y1 - 1) / y3;
res += ((y1 + k * y3) + y1) * (k + 1) / 2;
cout << y1 << ' ' << y2 << ' ' << y3 << ' ' << k << endl;
}
}
else
{
if (y1 > y2)
{
int k = (y1 - y2 - 1) / -y3;
res += (y1 + k * y3 + y1) * (k + 1) / 2;
}
}
}
cout << res << endl;
}
signed main()
{
// ios::sync_with_stdio(false);
// cin.tie(0);
// cout.tie(0);
int t = 1;
// cin >> t;
while (t--)
solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3876kb
input:
ans=0 for a in range(1,3): for b in range(5,1,-2): ans+=b print(ans)
output:
1 3 1 b 5 1 -2 16
result:
wrong answer 1st lines differ - expected: '16', found: '1 3 1'