首页 > TAG信息列表 > llu

CF1244C The Football Season 题解

CF1244C The Football Season 洛谷链接 题意:求一组 $x,y(x + y \le n)$,使得 $w \cdot x + d \cdot y = p$。 看到这样的题,第一反应当然是用扩欧直接写。 然而本题数据规模太大,会导致 $\text{TLE}$。 换一种思路:题目中指明 $w \gt d$,从这个角度下手。 要让 $x+y \le n$,不难发现只

csp-小明放学

其实本质就是时钟循环 #include<iostream> #pragma warning(disable:4996)//忽略scanf不安全的警告 using namespace std; unsigned long long r,y,g,st=0,t,n;//st=sum time 总时间 t为坐标轴映射时间 int traffic_signal_waiting_time(unsigned long long time, int sign

POJ2115C Looooops

http://poj.org/problem?id=2115 k位储存特点,一旦溢出,那么就到第二个循环开始返回0重新计数。问题实际转化成a+cx=b(mod 2^k)跑多少圈能够重合。因为是k位无符号,所以直接就是2^k次方,0~2^k-1。刚好覆盖模的范围 1 #include<iostream> 2 #include<cstdio> 3 #include<math.h> 4 #

(UVA - 11582)Colossal Fibonacci Numbers!(递推+快速幂,无符号长整型)

链接: https://vjudge.net/problem/UVA-11582 The i’th Fibonacci number f(i) is recursively defined in the following way: • f(0) = 0 and f(1) = 1 • f(i + 2) = f(i + 1) + f(i) for every i ≥ 0 Your task is to compute some values of this sequence. Input Input b