小Z的袜子(题解)(莫队) Junlier良心莫队 题目 luoguP1494 [国家集训队]小Z的袜子 code #include<bits/stdc++.h> #define lst long long #define ldb double #define N 50050 using namespace std; const int Inf=1e9; int read() { int s=0,m=0;char ch=getchar(); while(ch<'0'||ch>'9'…
小B的询问(题解)(莫队) Junlier良心莫队 题目 luoguP2709 小B的询问 code #include<bits/stdc++.h> #define lst long long #define ldb double #define N 50050 using namespace std; const int Inf=1e9; int read() { int s=0,m=0;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch…
这题打着高精的旗号其实是闹着玩的……(我不是题目) 数据范围就是提示你这题O(1)的 我们知道,一个数膜9的余数等于它数字和膜9的余数 我们可以把l到r加起来然后膜9 也就是(l+r)(r-l+1)/2%9 出现了除法所以我们把/2转化成逆元*5 就完了. #include<bits/stdc++.h> using namespace std; long long q,l,r; int main(){ cin>>q; while(q--){ cin>>l>>…
C 小G坐电梯 题目描述 小G来到了著名的某大厦.大厦一共有n层,初始的时候小G在第 A 层. 小G特别想去B层小 M 的办公室看一看,然而因为安保原因,B层已经被封锁无法进入. 但是小G既然来了,就想在大厦里面逛一逛.大厦里面有一部电梯,小G决定坐 k 次电梯. 因为小G比较无聊,他给自己设定了这样一个规矩:假如当前他在x层,则他要去的下一个楼层y和x的楼层差必须要小于 x 和 B 的楼层差,即 \(|x−y| < |x−B|\) . 每到达一个楼层,小G都要记录下来其楼层号. 当小G转完一圈…
猜数字的大小游戏 C:\Users\Administrator>python Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >…
#Filename:game1.py guess=10 running=True while running: try: answer=int(raw_input('Guess what i think:')) except: print 'Please input interga\n' continue if answer<guess: print 'Your answer is too small\n' continue elif answer>guess: print 'Your ans…