QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#163775 | #7025. How Much Memory Your Code Is Using? | ballance | WA | 18ms | 3688kb | C++23 | 1.5kb | 2023-09-04 15:04:43 | 2023-09-04 15:04:43 |
Judging History
answer
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<string>
using namespace std;
const int tran = 1024;
int f(string str)
{
int len = str.size();
for (int i = 0; i < len; i++)
{
char e = str[i];
if (e == ';')
break;
if (e != '\n' && e != '[')
continue;
else if (e == '\n')
break;
else
{
int k = 0;
for (int j = i + 1; isdigit(str[j]); j++)
k = k * 10 + str[j] - '0';
return k;
}
}
return 1;
}
int main()
{
int t, cnt = 0, n;
scanf("%d", &t);
string str;
for (int ii = 1; ii <= t; ii++)
{
scanf("%d", &n);
getchar();
long long num = 0;//字节
for (int iii = 1; iii <= n; iii++)
{
getline(cin, str);
int len = str.size();
if (str[0] == 'b' || str[0] == 'c')//bool 一字节
{
num += f(str);
}
else if (str[0] == 'i' || str[0] == 'f')
{
num += 4 * f(str);
// cout<<num<<endl;
}
else if (str[0] == 'd') {
num += 8 * f(str);
}
else if (str[0] == '_') {
num += 16 * f(str);
}
else if (str[0] == 'l')
{
if (str[5] == 'd') {//long double 想用 substr 判断double 结果不对emm
num += 16 * f(str);
}
else {
num += 8 * f(str);
}
}
if (num % 100000 && iii == 9)
cout << str << '\n';
//cout<<num<<endl;
}
//cout<<num<<endl;
int ans;
if (num % tran == 0) ans = num / tran;
else ans = 1 + num / tran;
printf("Case #%d: %d\n", ++cnt, ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3660kb
input:
2 8 bool a; char b; int c; long long d; __int128 e; float f; double g; long double h; 1 int a[1000];
output:
Case #1: 1 Case #2: 4
result:
ok 2 lines
Test #2:
score: -100
Wrong Answer
time: 18ms
memory: 3688kb
input:
100 976 bool qhtwlyq; bool pwwmfdzmn; bool mcrxalwy; bool geqhbouv; bool dxv; bool tbfcpc; bool qnv; bool zgobcqpd; bool b; bool v; bool oyaisd; bool llcktmy; bool bnyp; bool hvkyjkuuix; bool briut; bool xqoea; bool pcecgpydon; bool fwmmtbgn; bool ivnhli; bool js; bool anxutjks; bool va; bool dngtl;...
output:
bool b; Case #1: 1 char uhzh; Case #2: 1 int aaa; Case #3: 4 long long ahznu; Case #4: 8 __int128 orpec; Case #5: 16 float a; Case #6: 4 double olonawdcjz; Case #7: 8 long double lmrnrxj; Case #8: 16 Case #9: 92383 Case #10: 96778 Case #11: 382422 Case #12: 750000 Case #13: 1492188 Case #14: 378907 ...
result:
wrong answer 1st lines differ - expected: 'Case #1: 1', found: 'bool b;'