-
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 #include2 #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