167 条题解
-
0小岛 LV 10 @ 2008-12-27 21:04:19
const
infinity=maxlongint;
mmax=13;
type
int=longint;
var
d:array[0..1,0..mmax] of int; p,q:int;
M,S,T:int; ans:int;
i,j:int; t0:int; s0:int;
function max(a,b:int):int;
begin
if a>b then exit(a)
else exit(b);
end;
procedure check;
begin
for j:=0 to 13 do
if d[p,j]>=S then begin
writeln('Yes');
writeln(i);
readln(S);
halt
end;
end;
begin
for i:=0 to 1 do
for j:=0 to mmax do
d:=-infinity;readln(M,S,T);
t0:=m div 10; if t0>t then begin writeln('No');writeln(t*60);halt end;
s0:=t0*60;if s0>=s then begin writeln('Yes');writeln((s-1) div 60 +1);halt end;
m:=m mod 10;
q:=0;p:=1;d[p,m]:=s0;for i:=t0+1 to T do
begin
q:=p; p:=1-p;
for j:=4 to 13 do
d[p,j]:=max(d[q,j]+17,d[q,j-4]);
for j:=0 to 3 do
d[p,j]:=max(d[q,j]+17,d[q,j+10]+60);check;
end;ans:=0;writeln('No');
for j:=0 to 13 do
ans:=max(ans,d[p,j]);
writeln(ans);
readln(S);
end.
//以上是解法1type
int=longint;
var
m,s,t:int;
s0,t0:int;
begin
readln(m,s0,t0);
t:=0;
repeat
inc(t);
{case 1: 能闪则闪..}
if m>=10 then begin inc(s,60);dec(m,10) end else
{case 2: 时间剩的不多了...}
if ((t0-t)*4+m) -
02008-12-24 16:42:31@
program ex1;
var
a,b:array[-30..1000]of longint;
m,s,t,sum,total:longint;
function max(k1,k2,k3:longint):longint;
begin
if k1=s then
begin
writeln('Yes');
writeln(total);
halt;
end
else if total=t then
begin
writeln('No');
writeln(sum);
halt;
end;
end;
for i:=-30 to 100 do b[i]:=sum;
for i:=total+1 to t do begin
for j:=-30 to 100 do begin
if j>=10 then
a[j]:=max(b[j]+17,b[j-10]+60,b[j+4])
else a[j]:=max(b[j]+17,0,b[j+4]);
end;
if a[m]>=s then begin
writeln('Yes');
writeln(i);
halt;
end;
b:=a;
end;
writeln('No');
writeln(b[m]);
end;
begin
readln(m,s,t);
shou;
end. -
02008-12-24 16:42:10@
program fa;
var
f1,f2:array[-30..1000] of longint;
m,s,t,mm,ss,tt,i,j,max:longint;function maxx(s1,s2:longint):longint;
begin
if s1>s2 then
begin
maxx:=s1;
exit;
end;
maxx:=s2;
end;begin
readln(m,s,t);
mm:=m; ss:=0; tt:=0;
while (mm>=10) and (ss=s) and (tt=s then
begin
writeln('Yes');
writeln(i);
halt;
end;
end;
writeln('No');
writeln(max);
end.---|---|---|---|---|---|---|--
先贪心,再DP! -
02008-12-13 17:52:33@
#include
using namespace std;int main() {
int m,s,t,cs,ct;
cin>>m>>s>>t;
cs=s,ct=t;
while(1) {
while(m>=10) {
m-=10,cs-=60,ct--;
if(cs -
02008-11-27 21:28:46@
#include "stdio.h"
#include "conio.h"
int main(){long i,j,k,n,m,x,y,s,t,t2,s1;
scanf("%ld",&m);
scanf("%ld",&s);
scanf("%ld",&t);
t2=t;s1=s;while(s>0) {
if(m>=10) {m=m-10;s=s-60;}
else if(m>=6&&t2==2) m=m+4;
else if(m -
02008-11-25 17:50:09@
program aa;
var
m,t,s,s1,q,b:longint;
begin
readln(m,s,t);
q:=s;
s1:=0;
while (s>0)and(t>0) do
begin
if s mod 17>0 then b:=1 else b:=0;
if m>=10 then begin t:=t-1;s:=s-60;m:=m-10;s1:=s1+1; end else begin
if m -
02008-11-22 19:15:35@
记录号 Flag 得分 记录信息 环境 评测机 程序提交时间
R1073594 Unaccepted 80 From zgx-
P1431 FPC Vag 6K 2008-11-22 18:14:11From 搁浅
守望者的逃离 全国青少年信息学奥林匹克分区联赛 (NOIp) 竞赛原题编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms注意要用longint!!!
用动规
-
02008-11-18 15:06:11@
先预处理,再用递归,也可直接AC
-
02008-11-13 21:31:16@
var
w,q,m,s,t,i,j:longint;
a:array[1..200,1..200,1..2]of longint;
begin
readln(m,s,t);
q:=s;
while (m>=10)and(t>0)and(s>0)do
begin
dec(m,10);
dec(s,60);
dec(t,1);
end;
w:=m;
if(sa
if a>10
then begin
a:=a[i-(10-w)div 4,then
放防 -
02008-11-13 20:29:30@
贪心AC,(发发牢骚:一开始时忽略了一个很细小的判断TOT没AC)
思路是这样的,从1到t枚举补魔法的时间,补了魔法后一定是有多少用多少,等用完了再用普通的移动方式,这样就可以轻松出解了,时间为O(T)- -b -
02008-11-13 17:36:51@
贪心 19行搞定
编译通过...
├ 测试数据 01:答案正确... 0ms
├ 测试数据 02:答案正确... 0ms
├ 测试数据 03:答案正确... 0ms
├ 测试数据 04:答案正确... 0ms
├ 测试数据 05:答案正确... 0ms
├ 测试数据 06:答案正确... 0ms
├ 测试数据 07:答案正确... 0ms
├ 测试数据 08:答案正确... 0ms
├ 测试数据 09:答案正确... 0ms
├ 测试数据 10:答案正确... 0ms
---|---|---|---|---|---|---|---|-
Accepted 有效得分:100 有效耗时:0ms -
02008-11-13 11:09:15@
龙好伟大!
在Puppy上90分;
在Dragon上AC了 -
02008-11-12 21:15:57@
贪心..17*2.5
-
02008-11-11 21:31:00@
#include
using namespace std;
int main(){
int m,s,t;
int t1;
int k;
int i;
int len=0;
cin>>m>>s>>t;
t1=t;
while(m>=10&&len0){len+=60;
m-=10;
t--;
}
if(len>=s){cout -
02008-11-11 16:50:36@
lll
-
02008-11-10 22:09:36@
此题不可做!
-
02008-11-09 14:14:52@
贪心AC!!!!!!!
while (s>0) and (t0) do begin
if m>=10 then
begin
s:=s-60;
m:=m-10;
dec(t);
end
else if (m>=6) and (s>=34) and (t>=2) then
begin
s:=s-60;
m:=m-6;
dec(t,2);
end
else if (m>=2) and (s>=51) and (t>=3) then
begin
s:=s-60;
m:=m-2;
dec(t,3)
end
else if (s>=111) and (t>=4) then
begin
s:=s-60;
m:=m+2;
dec(t,4);
end
else
begin
dec(s,17);
dec(t);
end;
end; -
02008-11-08 21:49:27@
var k,a,m,s,t:longint;
begin
readln(m,s,t);
a:=m div 10+(s-m div 10*60)div 17;
if t>=a then begin
writeln('YES');
writeln(a);
end;
if t -
02008-11-07 12:19:05@
个人认为f:=max(f+17,f+60,f 与
f:=max(f+17,f+60,f 都可以。
分情况讨论,虽然只能过8个,但是感觉更符合常规思维
把二维降到一维 -
02008-11-06 18:15:29@
#include
int m,s;
double t;
void init()
{
scanf("%d%d%lf",&m,&s,&t);
}
void work()
{int j,bj=0;
double i,ch=0,ch1=0;
for(i=1;i=10){m=m-10;ch+=60;}
else m+=4;
if(ch>ch1)ch1=ch;
if(ch1>=s){printf("Yes\n%.0lf",i);break;}
}
if(i>t)
printf("No\n%.0lf",ch1);}
main()
{
init();
work();
return 0;
}
AC !