2018icpc沈阳/gym101955 J How Much Memory Your Code Is Using? 签到
题意:
给你定义一堆变量,计算一下这些变量共占了多少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? 签到的更多相关文章
- 计蒜客 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 ...
- 2018-icpc沈阳-G-思维
http://codeforces.com/gym/101955/problem/G 给出一个6000*6000的坐标系,有四种操作,一是加入放置一个点到某个空格子上,二是从某个有点的格子移走一个点, ...
- 2018ICPC 南京Problem J. Prime Game
题目: 题意:给出一个序列a1,⋯,ana1,⋯,an.fac(l,r)fac(l,r)为mul(l,r)mul(l,r)中不同质因数的个数. 请计算: ∑i=1n∑j ...
- 计蒜客 31447 - Fantastic Graph - [有源汇上下界可行流][2018ICPC沈阳网络预赛F题]
题目链接:https://nanti.jisuanke.com/t/31447 "Oh, There is a bipartite graph.""Make it Fan ...
- 计蒜客 31452 - Supreme Number - [简单数学][2018ICPC沈阳网络预赛K题]
题目链接:https://nanti.jisuanke.com/t/31452 A prime number (or a prime) is a natural number greater than ...
- 【2018ICPC沈阳】
哈密顿距离转切比雪夫距离,多种颜色跟两种颜色没有区别,记录最大最小次大次小即可. 圆求交点.
- 2018ICPC青岛赛区J题
题目链接:http://acm.zju.edu.cn/onlinejudge/showRuns.do?contestId=1 这题真的坑,为什么要买0本书的时候,书架里面刚好有价格为0的时候输出&qu ...
- Gym.101955: Asia Shenyang Regional Contest(寒假自训第10场)
C.Insertion Sort 题意:Q次询问,每次给出N,M,Mod,问你有多少种排列,满足前面M个数字排序之后整个序列的LIS>=N-1. 思路:我们把数字看成[1,M],[N-M+1,N ...
- 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 ...
随机推荐
- 【原】通过npm script运行webpack的原理
原理:在项目中,局部安装依赖,依赖如果有创建命令的情况下会在node_modules/.bin目录创建软链接,pack.json默认读取到.bin下的命令. 如有理解不对,请各位大神纠正
- Python 进阶_OOP 面向对象编程_组合与继承
#目录 前言 组合 派生 通过继承来覆盖重载方法 最常用的重载场景实例方法的重载 从标准类中派生类方法的重载 前言 我们定义一个类是希望能够把类当成模块来使用,并把类嵌入到我们的应用代码中,与其他的数 ...
- Python 进阶_OOP 面向对象编程_静态方法和类方法
目录 目录 静态方法 类方法 使用函数修饰符来声明静态方法和类方法 静态方法 静态方法仅是类中的函数, 不需要绑定实例, 也就是说静态方法的定义不需要传入 self 参数. 静态方法不属于类的某一个实 ...
- 判断是否是NaN
if (isNaN(parseInt(x))) { alert("非数字"); } else{ alert("数字"); }
- C# DotNetZip压缩单、多文件以及文件夹
有些项目为了更好的用户体验,会把下载文件做成一个压缩的文件,直接下载,免得去一个个的点击下载文件.网上有很多压缩文件的方法,也有第三方的分装DLL文件,本文主要介绍DotNetZip压缩方法. Dot ...
- spring boot 尚桂谷学习笔记11 数据访问03 JPA
整合JPA SpringData 程序数据交互结构图 (springdata jpa 默认使用 hibernate 进行封装) 使用之后就关注于 SpringData 不用再花多经历关注具体各个交互框 ...
- LeetCode 95. Unique Binary Search Trees II 动态演示
比如输入为n, 这道题目就是让返回由1,2,... n的组成的所有二叉排序树,每个树都必须包含这n个数 这是二叉树的排列组合的题目.排列组合经常用DFS来解决. 这道题比如输入为3,也就是求start ...
- C语言深度剖析自测题8解析
#include <stdio.h> int main(void) { int a[5] = {1, 2, 3, 4, 5}; int* ptr1 = (int*)(&a ...
- 这么简单的 Redis 面试题都不懂,怎么拿offer?
来源:mp.weixin.qq.com/s/daBkliC8dAT_zYyoLiS7WA 随着系统访问量的提高,复杂度的提升,响应性能成为一个重点的关注点.而缓存的使用成为一个重点.redis 作为缓 ...
- Fix invisible cursor issue in Ubuntu 13.10
Fix invisible cursor issue in Ubuntu 13.10 Fixing this problem is rather too easy. Open a terminal ( ...