QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#710221 | #9255. Python Program | wysun | WA | 0ms | 3464kb | C++14 | 1.7kb | 2024-11-04 19:07:03 | 2024-11-04 19:07:03 |
Judging History
answer
#include <iostream>
using namespace std;
typedef long long LL;
int main()
{
int T;
T = 1;
while(T --)
{
string s;
for(int i=1;i<=5;i++) cin>>s;
string a, b, c, d, e, f;
int i;
s = s.substr(6);
s = s.substr(0, s.find(')'));
i = s.find(',');
a = s.substr(0, i);
s = s.substr(i + 1);
i = s.find(',');
if (i == -1)
{
b = s;
c = "1";
}
else
{
b = s.substr(0, i);
c = s.substr(i + 1);
}
for(int i=1;i<=4;i++) cin >> s;
s = s.substr(6);
s = s.substr(0, s.find(')'));
i = s.find(',');
d = s.substr(0, i);
s = s.substr(i + 1);
i = s.find(',');
if (i == -1)
{
e = s;
f = "1";
}
else
{
e = s.substr(0, i);
f = s.substr(i + 1);
}
for(int i=1;i<=2;i++) cin >> s;
LL ans = 0;
int va = stoi(a);
int vb = stoi(b);
int vc = stoi(c);
for (int i = va; (vc > 0 ? i < vb : i > vb); i += vc)
{
int vd = isdigit(d[0]) ? stoi(d) : i;
int ve = isdigit(e[0]) ? stoi(e) : i;
int vf = isdigit(f[0]) ? stoi(f) : i;
if (vf > 0)
{
if (vd < ve)
{
LL k = (ve - vd - 1) / vf;
ans += 1ll * (vd + vd + k * vf) * (k + 1) / 2;
}
}
else
{
if (vd > ve)
{
LL k = (vd - ve - 1) / -vf;
ans += 1ll * (vd + vd + k * vf) * (k + 1) / 2;
}
}
}
cout << ans << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3464kb
input:
ans=0 for a in range(1,3): for b in range(5,1,-2): ans+=b print(ans)
output:
0
result:
wrong answer 1st lines differ - expected: '16', found: '0'