题意:

给你定义一堆变量,计算一下这些变量共占了多少k内存。

题解:

按题意模拟即可,善用ceil()

//
// Created by melon on 2019/10/22.
//
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dbg(x) cout<<#x<<"="<<x<<endl
char s[+],s1[+],s2[+];
int byt(char ss[])
{
if(strcmp(ss,"bool")==||strcmp(ss,"char")==) return ;
if(strcmp(ss,"int")==||strcmp(ss,"float")==) return ;
if(strcmp(ss,"long long")==||strcmp(ss,"double")==) return ;
if(strcmp(ss,"__int128")==||strcmp(ss,"long double")==) return ;
}
int main()
{
// ios::sync_with_stdio(false);
int T;
scanf("%d",&T);
for(int _=;_<=T;++_)
{
printf("Case #%d: ",_);
ll ans=;
int x;
scanf("%d",&x);
while(x--)
{
scanf("%s",s);
if(s[]=='l')
{
scanf("%s",s1);
strcat(s," ");
strcat(s,s1);
}
scanf("%s",s2);
int per=byt(s);
int l2=strlen(s2);
int flag=,flag1=;
for(int i=;i<l2;++i)
{
if(s2[i]=='[')
{
flag=i;
}
if(s2[i]==']')
{
flag1=i;break;
}
}
int num=;
if(flag)
{
for (int i = flag+; i<flag1; ++i) {
num = num * + (s2[i] - '');
}
ans+=num*per*1LL;
// dbg(num);
}
else ans+=(ll)per;
//dbg(ans);
} ll anss=ceil(ans*1.0/);
cout<<anss<<endl;
}
} /*
* Case #1: 1
* Case #1: 1
*/

2018icpc沈阳/gym101955 J How Much Memory Your Code Is Using? 签到的更多相关文章

  1. 计蒜客 31451 - Ka Chang - [DFS序+树状数组][2018ICPC沈阳网络预赛J题]

    题目链接:https://nanti.jisuanke.com/t/31451 Given a rooted tree ( the root is node $1$ ) of $N$ nodes. I ...

  2. 2018-icpc沈阳-G-思维

    http://codeforces.com/gym/101955/problem/G 给出一个6000*6000的坐标系,有四种操作,一是加入放置一个点到某个空格子上,二是从某个有点的格子移走一个点, ...

  3. 2018ICPC 南京Problem J. Prime Game

    题目: 题意:给出一个序列a1,⋯,ana1,⋯,an.fac(l,r)fac(l,r)为mul(l,r)mul(l,r)中不同质因数的个数. 请计算:                 ∑i=1n∑j ...

  4. 计蒜客 31447 - Fantastic Graph - [有源汇上下界可行流][2018ICPC沈阳网络预赛F题]

    题目链接:https://nanti.jisuanke.com/t/31447 "Oh, There is a bipartite graph.""Make it Fan ...

  5. 计蒜客 31452 - Supreme Number - [简单数学][2018ICPC沈阳网络预赛K题]

    题目链接:https://nanti.jisuanke.com/t/31452 A prime number (or a prime) is a natural number greater than ...

  6. 【2018ICPC沈阳】

    哈密顿距离转切比雪夫距离,多种颜色跟两种颜色没有区别,记录最大最小次大次小即可. 圆求交点.

  7. 2018ICPC青岛赛区J题

    题目链接:http://acm.zju.edu.cn/onlinejudge/showRuns.do?contestId=1 这题真的坑,为什么要买0本书的时候,书架里面刚好有价格为0的时候输出&qu ...

  8. Gym.101955: Asia Shenyang Regional Contest(寒假自训第10场)

    C.Insertion Sort 题意:Q次询问,每次给出N,M,Mod,问你有多少种排列,满足前面M个数字排序之后整个序列的LIS>=N-1. 思路:我们把数字看成[1,M],[N-M+1,N ...

  9. Codeforces Round #370 (Div. 2) E. Memory and Casinos 线段树

    E. Memory and Casinos 题目连接: http://codeforces.com/contest/712/problem/E Description There are n casi ...

随机推荐

  1. SQL学习记录:函数(二)

    字符串函数 1.获取字符的ASCII码 语法结构: ASCII(espression)    这里的expression是一个返回char或varchar数据类型的表达式,ASCII函数仅对表达式最左 ...

  2. delphi 简单的发送字符串消息

    var pMes:^String; begin New(pMes); pMes^:=msg; PostMessage(Application.handle, WM_Custom, 0, Integer ...

  3. play framework 在idea简单运行配置(mac为例)

    文章目录 play 最基本的构建 在idea中配置 配置jdk相关 配置play 运行 运行 play 最基本的构建 https://blog.csdn.net/dataiyangu/article/ ...

  4. Ajax的那点事

    Ajax中什么是同步.异步? 同步:就是用户填写完信息之后,全部提交给服务器,等待服务器的回应,是一次性全部的. 异步:当用户填写完一条信息之后,这条信息会自动向服务器提交,然后服务器响应客户端,在此 ...

  5. .eslintrc.js相关配置

    module.exports = { root: true, //此项是用来指定javaScript语言类型和风格,sourceType用来指定js导入的方式,默认是script,此处设置为modul ...

  6. C++中的类与封装

    1,类的组合: 1,类不是孤立存在的,类之间都会有一些关系,组合就是类的基本关系之一: 2,电脑一般而言是由 CPU.内存.主板.键盘和硬盘等部件组合而成: 3,学习电脑组装需要多少时间?学习电脑组装 ...

  7. go 发送http请求

    普通的get请求 package main import ( "io/ioutil" "fmt" "net/http" ) func mai ...

  8. 54.Counting Bits( 计算1的个数)

    Level:   Medium 题目描述: Given a non negative integer number num. For every numbers i in the range 0 ≤ ...

  9. 43.和为S的连续正数序列

    题目描述:   小明很喜欢数学,有一天他在做数学作业时,要求计算出9~16的和,他马上就写出了正确答案是100.但是他并不满足于此,他在想究竟有多少种连续的正数序列的和为100(至少包括两个数).没多 ...

  10. vue项目的脚手架

    > cnpm i @vue/cli@3 -g > vue create myapp * 选择 Manually select features ----- 自选预设文件 * 选择 vue ...