【NOIP2017练习】溢出(模拟)
题意:




思路:

a*b<=c <====> b<=c div a
var ch,maxs,s:ansistring;
v,k,i,maxl,l,len,cnt,cas:longint;
now,tmp,max:qword;
flag:boolean; begin
assign(input,'overflow.in'); reset(input);
assign(output,'overflow.out'); rewrite(output);
readln(cas);
for v:= to cas do
begin
readln(ch); len:=length(ch);
max:=; k:=;
for i:= to len do
if (ch[i]>='')and(ch[i]<='') then k:=k*+ord(ch[i])-ord('');
if k= then maxl:=;
if k= then maxl:=;
if k= then maxl:=;
if k= then
if ch[]='i' then maxl:=
else maxl:=;
if ch[]='i' then dec(k);
for i:= to k- do max:=max*;
max:=max-+max;
str(max,maxs);
readln(ch); len:=length(ch);
flag:=false;
i:=; now:=; cnt:=;
while (not flag)and(i<=len) do
begin
inc(i); tmp:=; l:=; s:=''; inc(cnt);
while (i<=len)and(ch[i]>='')and(ch[i]<='') do
begin
inc(l); s:=s+ch[i];
if (l>maxl)or(l=maxl)and(s>maxs) then
begin
flag:=true; break;
end;
tmp:=tmp*+ord(ch[i])-ord('');
inc(i);
end;
if flag then break;
if now>max div tmp then
begin
flag:=true; break;
end;
now:=now*tmp;
end;
if flag then writeln(cnt)
else writeln('never');
end; close(input);
close(output);
end.
【NOIP2017练习】溢出(模拟)的更多相关文章
- JZOJ 5196. 【NOIP2017提高组模拟7.3】B
5196. [NOIP2017提高组模拟7.3]B Time Limits: 1000 ms Memory Limits: 262144 KB Detailed Limits Goto Pro ...
- JZOJ 5197. 【NOIP2017提高组模拟7.3】C
5197. [NOIP2017提高组模拟7.3]C Time Limits: 1000 ms Memory Limits: 262144 KB Detailed Limits Goto Pro ...
- JZOJ 5195. 【NOIP2017提高组模拟7.3】A
5195. [NOIP2017提高组模拟7.3]A Time Limits: 1000 ms Memory Limits: 262144 KB Detailed Limits Goto Pro ...
- JZOJ 5184. 【NOIP2017提高组模拟6.29】Gift
5184. [NOIP2017提高组模拟6.29]Gift (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB Detailed ...
- JZOJ 5185. 【NOIP2017提高组模拟6.30】tty's sequence
5185. [NOIP2017提高组模拟6.30]tty's sequence (Standard IO) Time Limits: 1000 ms Memory Limits: 262144 KB ...
- NOIP2017提高组 模拟赛15(总结)
NOIP2017提高组 模拟赛15(总结) 第一题 讨厌整除的小明 [题目描述] 小明作为一个数学迷,总会出于数字的一些性质喜欢上某个数字,然而当他喜欢数字k的时候,却十分讨厌那些能够整除k而比k小的 ...
- NOIP2017提高组 模拟赛13(总结)
NOIP2017提高组 模拟赛13(总结) 第一题 函数 [题目描述] [输入格式] 三个整数. 1≤t<10^9+7,2≤l≤r≤5*10^6 [输出格式] 一个整数. [输出样例] 2 2 ...
- NOIP2017提高组模拟赛 10 (总结)
NOIP2017提高组模拟赛 10 (总结) 第一题 机密信息 FJ有个很奇怪的习惯,他把他所有的机密信息都存放在一个叫机密盘的磁盘分区里,然而这个机密盘中却没有一个文件,那他是怎么存放信息呢?聪明的 ...
- NOIP2017提高组模拟赛 8(总结)
NOIP2017提高组模拟赛 8(总结) 第一题 路径 在二维坐标平面里有N个整数点,Bessie要访问这N个点.刚开始Bessie在点(0,0)处. 每一步,Bessie可以走到上.下.左.右四个点 ...
- NOIP2017提高组模拟赛 9 (总结)
NOIP2017提高组模拟赛 9 (总结) 第一题 星星 天空中有N(1≤N≤400)颗星,每颗星有一个唯一的坐标(x,y),(1≤x,y ≤N).请计算可以覆盖至少K(1≤K≤N)颗星的矩形的最小面 ...
随机推荐
- TDB 12c : Transportable Database
转 http://oracleinaction.com/12c-transportable-database/
- 使用nginx搭建简单文件服务器
最近再做一个博客,本想使用fastdfs标准的文件存储服务器,但考虑到资源占用问题,且使用nginx比较快速,且效果不差.于是采用ngixn搭建. nginx搭建文件服务器,本质上就是nginx的静态 ...
- oracle 时间格式转化以及计算
--A表中的日期字段 create_date 例如:2017-08-05 转化为2017年8月5日 oracle 在这里的双引号会忽略 select to_char(to_date(tt.c ...
- Python之三元运算、集合、函数
一.三元运算符 三元运算符就是在赋值变量的时候,可以直接加判断,然后赋值 格式:[on_true] if [expression] else [on_false] res = 值1 if 条件 els ...
- vue-cli中使用rem,vue自适应
2018年04月27日 09:25:34 董小礼 阅读数:4196 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/qq_39588818/ar ...
- DEALLOCATE - 删除一个准备好的查询
SYNOPSIS DEALLOCATE [ PREPARE ] plan_name DESCRIPTION 描述 DEALLOCATE 用于删除前面准备好的查询. 如果你没有明确 DEALLOCATE ...
- Python中yield函数浅析
带有yield的函数在Python中被称之为generator(生成器),下面我们将使用斐波那契数列来举例说明下该函数:(环境是在Python3.x下) 如何生成斐波那契数列: 斐波那契(Fibon ...
- Bitmap.createBitmap函数有6个重载方法
位图剪切参考重载方法4和6,重载方法6比较简单 public static Bitmap createBitmap (Bitmap src)从原位图src复制出一个新的位图,和原始位图相同 publi ...
- div 可视化区域弹窗居中
效果: css: .div_alt { position: fixed; border-radius: 5px; top: 50%; left: 50%; width: auto; min-width ...
- 关于阻止Sublime Text更新弹窗提示
使用Sublime Text有一段时间了,但每次重新打开都会弹出这家伙↑,很烦 网上查了查一些关闭弹窗的教程,大同小异,都说是打开Preferences --> Settings, 添加一行代码 ...