QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#577049#9255. Python ProgramSkyEyeControllerTL 0ms4068kbC++231.9kb2024-09-20 00:43:022024-09-20 00:43:02

Judging History

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

  • [2024-09-20 00:43:02]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:4068kb
  • [2024-09-20 00:43:02]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
    int ans = 0;
    scanf("ans=%lld\n", &ans);
    map<int, int> mp;
    char c1, s[30];
    memset(s, 0, sizeof(s));
    map<char, int> m;
    scanf("for %c in range(%s", &c1, s);
    int a[3] = {0, 0, 1};
    int pos = 0;
    int num = 0;
    int tag = 1;
    for (int i = 0; i < strlen(s); i++)
    {
        if (s[i] == '-')
        {
            tag = -1;
        }
        else if (s[i] >= '0' && s[i] <= '9')
        {
            num = num * 10 + (s[i] & 15);
        }
        else if (s[i] == ',' || s[i] == ')')
        {
            a[pos++] = num * tag;
            num = 0;
            tag = 1;
        }
        else
            continue;
    }
    int b[3] = {0, 0, 1};
    char flag[3] = {0, 0, 0};
    pos = 0;
    memset(s, 0, sizeof(s));
    char c2;
    scanf("    for %c in range(%s", &c2, s);
    num = 0;
    tag = 1;
    for (int i = 0; i < strlen(s); i++)
    {
        if (s[i] == '-')
            tag = -1;
        else if (s[i] >= '0' && s[i] <= '9')
        {
            num = num * 10 + (s[i] & 15);
        }
        else if (s[i] >= 'a' && s[i] <= 'z')
        {
            flag[pos] = s[i];
        }
        else if (s[i] == ',' || s[i] == ')')
        {
            b[pos++] = num * tag;
            num = 0;
            tag = 1;
        }
        else
            continue;
    }
    char c3;
    scanf("        ans+=%c", &c3);
    memset(s, 0, sizeof(s));
    scanf("%s", s);
    for (mp[c1] = a[0]; mp[c1] * a[2] / abs(a[2]) < a[1] * a[2] / abs(a[2]); mp[c1] += a[2])
    {
        int add = (flag[2] == 0 ? b[2] : mp[flag[2]]);
        for (mp[c2] = (flag[0] == 0 ? b[0] : mp[flag[0]]); mp[c2] * add / abs(add) < (flag[1] == 0 ? b[1] : mp[flag[1]]) * add / abs(add); mp[c2] += add)
        {
            ans += mp[c3];
        }
    }
    printf("%lld\n", ans);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3856kb

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
Time Limit Exceeded

input:

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

output:


result: