QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#163760#7025. How Much Memory Your Code Is Using?ballanceRE 0ms0kbC++231.4kb2023-09-04 14:53:362023-09-04 14:53:36

Judging History

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

  • [2023-09-04 14:53:36]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2023-09-04 14:53:36]
  • 提交

answer

#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;
			while (isdigit(e == cin.get()))
			{
				k = k * 10 + e - '0';
			}
			return k;
		}
	}
}
int main()
{
	int t, cnt = 0, n;
	scanf("%d", &t);
	string str;
	while (t--)
	{
		scanf("%d", &n);
		getchar();
		long long num = 0;//字节 
		while (n--)
		{
			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);
				}
			}
			//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;
}

详细

Test #1:

score: 0
Runtime Error

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:


result: