博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
zoj 4056
阅读量:5092 次
发布时间:2019-06-13

本文共 2137 字,大约阅读时间需要 7 分钟。

  • At 0 second, the LED light is initially off. After BaoBao presses the button 2 times, the LED light turns on and the value of the counter changes to 1. The value of the timer is also set to 2.5 seconds. After DreamGrid presses the button 1 time, the value of the counter changes to 2.

  • At 2.5 seconds, the timer counts down to 0 and the LED light is off.

  • At 5 seconds, after DreamGrid presses the button 1 time, the LED light is on, and the value of the timer is set to 2.5 seconds.

  • At 7.5 seconds, the timer counts down to 0 and the LED light is off.

  • At 8 seconds, after BaoBao presses the button 2 times, the LED light is on, the value of the counter changes to 3, and the value of the timer is set to 2.5 seconds.

  • At 10 seconds, after DreamGrid presses the button 1 time, the value of the counter changes to 4, and the value of the timer is changed from 0.5 seconds to 2.5 seconds.

  • At 12.5 seconds, the timer counts down to 0 and the LED light is off.

  • At 15 seconds, after DreamGrid presses the button 1 time, the LED light is on, and the value of the timer is set to 2.5 seconds.

  • At 16 seconds, after BaoBao presses the button 2 times, the value of the counter changes to 6, and the value of the timer is changed from 1.5 seconds to 2.5 seconds.

  • At 18 seconds, the game ends.

 

 

只要遇到a,c的倍数就会按b,d次按钮,若同是a,c的倍数,先a,后c

若按之前为暗,按一次变亮,若按之前为亮,按一次为计数器+1
每次按一下,都会让计时器重新设置为v+0.5(开始倒计时,时间到0,就会变暗)
问[0,t]的时间内,计数器最后为多少。(0为任意数的倍数)

 

1 #include 
2 #include
3 #include
4 #include
5 #include
6 #include
7 using namespace std; 8 #define ll long long 9 int T;10 ll a,b,c,d,v,t;11 ll gcd(ll a,ll b)12 {13 return b==0?a:gcd(b,a%b);14 }15 ll lcm(ll a,ll b)16 {17 return a*b/gcd(a,b);18 }19 ll x,y,z,cnt,ans,last;20 /*21 明显一个最小公倍数为一个周期22 0 :单独算23 再计算除一个周期的结果*周期数24 再加上不满一个周期的结果25 */26 int main()27 {28 scanf("%d",&T);29 while(T--){30 scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&v,&t);31 ans=b+d-1;32 x=0,y=0,last=0,cnt=0;//ans 不用再赋初值了33 /*34 35 */36 z=lcm(a,c);//(a,c) 不是(x,y)37 while(x

 

转载于:https://www.cnblogs.com/tingtin/p/9667078.html

你可能感兴趣的文章
【项目实施】项目考核标准
查看>>
spring-aop AnnotationAwareAspectJAutoProxyCreator类
查看>>
经典入门_排序
查看>>
Redis Cluster高可用集群在线迁移操作记录【转】
查看>>
二、spring中装配bean
查看>>
VIM工具
查看>>
javascript闭包
查看>>
@Column标记持久化详细说明
查看>>
创建本地yum软件源,为本地Package安装Cloudera Manager、Cloudera Hadoop及Impala做准备...
查看>>
mysql8.0.13下载与安装图文教程
查看>>
站立会议08(冲刺2)
查看>>
url查询参数解析
查看>>
http://coolshell.cn/articles/10910.html
查看>>
[转]jsbsim基础概念
查看>>
Thrift Expected protocol id ffffff82 but got 0
查看>>
【2.2】创建博客文章模型
查看>>
【3.1】Cookiecutter安装和使用
查看>>
【2.3】初始Django Shell
查看>>
Linux(Centos)之安装Redis及注意事项
查看>>
bzoj 1010: [HNOI2008]玩具装箱toy
查看>>