QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#690756#9255. Python ProgramfosovWA 31ms3820kbC++141.2kb2024-10-31 02:10:022024-10-31 02:10:03

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 02:10:03]
  • 评测
  • 测评结果:WA
  • 用时:31ms
  • 内存:3820kb
  • [2024-10-31 02:10:02]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;

#define ll long long
#define MOD ((int) (1e9) + 7)
#define pii pair<int, int>

#define N 200010
#define inf 0x7fffffff

string si, sa, sb, sc;
void read() {
    string buf, cu = ""; sc = "1";
    cin >> buf >> si;
    cin >> buf >> buf;
    buf = buf.substr(6, buf.size() - 6 - 2) + ",";

    string* cont[3] = { &sa, &sb, &sc };
    for (int i = 0, j = 0; i < buf.size(); ++ i) {
        if (buf[i] == ',') *cont[j ++] = cu, cu = "";
        else cu += buf[i];
    }
}

int i, ia, ib, ic;
int j, ja, jb, jc;

int main() {
#ifdef TEST
    freopen("zz.in", "r+", stdin);
#endif
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> si;
    read();
    ia = stoi(sa), ib = stoi(sb), ic = stoi(sc);
    read();
    
    
    int res = 0;
    for (i = ia; i * ic < ib * ic; i += ic) {
        ja = isalpha(sa[0]) ? i : stoi(sa);
        jb = isalpha(sb[0]) ? i : stoi(sb);
        jc = isalpha(sc[0]) ? i : stoi(sc);
        if (ja * jc >= jb * jc) continue;
        jb += jc < 0 ? 1 : -1;
        res += (ja + ja + (jb - ja) / jc * jc) * ((jb - ja) / jc + 1) / 2;
    }
    cout << res << '\n';

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

ans=0
for a in range(1,3):
    for b in range(5,1,-2):
        ans+=b
print(ans)

output:

16

result:

ok single line: '16'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

ans=0
for q in range(100,50,-1):
    for i in range(q,77,20):
        ans+=i
print(ans)

output:

2092

result:

ok single line: '2092'

Test #3:

score: -100
Wrong Answer
time: 31ms
memory: 3820kb

input:

ans=0
for i in range(1,1000000):
    for j in range(i,1,-1):
        ans+=j
print(ans)

output:

1182719329

result:

wrong answer 1st lines differ - expected: '166666666665500001', found: '1182719329'