寂寞的程序员
来源:互联网 发布:贵阳人口流入数据 编辑:程序博客网 时间:2024/05/17 08:28
题目描述
有两个寂寞的程序员J和Y,J说他可以两分钟敲8000字,Y说不信,于是J与Y的4kb/min机器人进行了一场打字比赛。机器人以匀高速敲着乱码,而J找到了帮他超越手速的键:CTRL。J可以花不同的时间进行以下操作:
敲一个字符
按CTRL-A
按CTRL-C
按CTRL-V
(具体效果请在记事本内实验)
你需要制定一个操作顺序,使得J在n毫秒内输入的字符数最多。
【数据范围】
30%的数据保证 n≤10
100%的数据保证 1≤n≤1,000;1≤cost≤n
输入格式
第一行五个整数 n cost_input cost_CtrlA cost_CtrlC cost_CtrlV,四个cost分别对应进行四个操作需要耗费的毫秒数
输出格式
一行一个整数,表示能够输入的最多字符数
样例输入
样例输出
type arr=array[0..1000] of longint;var n,a,b,c,d:longint;f:array[0..5000] of arr;ans:arr;m,i,j,k,sum:longint;procedure jia(var now:arr; x:longint);var i:longint;begin {for i:=1 to now[0] do begin now[i]:=now[i]+x; now[i+1]:=now[i+1]+now[i] div 1000000; now[i]:=now[i] mod 1000000; end; if now[now[0]+1]>0 then inc(now[0]);}//fuck now[1]:=now[1]+x; for i:=1 to now[0] do begin now[i+1]:=now[i+1]+now[i] div 1000000; now[i]:=now[i] mod 1000000; end; if now[now[0]+1]>0 then inc(now[0]);end;procedure cheng(var now:arr;x:longint);var i:longint;begin now[1]:=now[1]*x; for i:=2 to now[0] do begin now[i]:=now[i]*x; now[i]:=now[i]+now[i-1] div 1000000; now[i-1]:=now[i-1] mod 1000000; end; {if now[now[0]+1]>0 then inc(now[0]);} while now[now[0]]>=1000000 do begin inc(now[0]); now[now[0]]:=now[now[0]-1] div 1000000; now[now[0]-1]:=now[now[0]-1] mod 1000000; end;end;function right(arr1,arr2:arr):boolean;var i:longint;begin if arr1[0]>arr2[0] then exit(true); if arr1[0]<arr2[0] then exit(false); for i:=arr1[0] downto 1 do if arr1[i]>arr2[i] then exit(true) else if arr1[i]<arr2[i] then exit(false); exit(false);end;begin assign(input,'p2.in'); assign(output,'p2.out'); reset(input); rewrite(output); readln(n,a,b,c,d); b:=b+c; f[0,0]:=1; f[0,1]:=0; for i:=1 to n do begin if i-a>=0 then begin f[i]:=f[i-a]; jia(f[i],1); {if i=377 then writeln(f[i-a,0],'OX');} end else begin f[i,0]:=1; f[i,1]:=0; end; {if i=377 then begin end;} for j:=2 to (i-b) div d do begin ans:=f[i-b-d*j]; cheng(ans,j); if right(ans,f[i]) then begin f[i]:=ans; {if i=376 then writeln(j,' fuck',i-b-d*j);} end; end; end; write(f[n,f[n,0]]); for i:=f[n,0]-1 downto 1 do begin if f[n,i]<100000 then write(0); if f[n,i]<10000 then write(0); if f[n,i]<1000 then write(0); if f[n,i]<100 then write(0); if f[n,i]<10 then write(0); write(f[n,i]); end; close(input); close(output);end.
- 并不寂寞的程序员
- 程序员的寂寞!
- 寂寞的程序员
- 程序员选择的就是寂寞?
- 寂寞程序员
- 微软献给寂寞程序员同志们的…
- 微软献给寂寞程序员同志们的…
- 微软献给寂寞的程序员们的YY大片
- 微软献给寂寞程序员同志们的YY Vis…
- 程序员,不得不习惯一个人寂寞
- 寂寞的季节
- 寂寞的香味
- 真的寂寞吗?
- 寂寞的季节...陶喆
- 寂寞的心
- 孤独的寂寞
- 寂寞的火锅
- 寂寞的黄金周
- 合成/聚合复用原则(CSRP 笔记)
- UML Linux 编译, 启动,及调试
- jsp基本语法
- VS2010恢复默认
- 进行多线程并发程序,应该注意那些方面?
- 寂寞的程序员
- 贷款卡编码的校验方法
- 使用ibatis实现增删改查
- 快速组装angstrom系统
- 解决:“开机设置了密码,可开机时却没有提示要输入密码的提示框,还是直接进入系统”和“系统无法让您登陆.请确定您的用户名及域名无误,然后再输入密码.密码的字母必须使用正确的大小写”
- Java面向对象编程的入门理解
- 我在Eclipse中使用Tomcat插件的遇到的一些问题
- JSP语法简表
- BusyBox制作根文件系统