随笔分类 - 数学
摘要:【题目链接】:http://codeforces.com/contest/789/problem/C【题意】 看式子。 【题解】 考虑最后的答案区间; 如果那个区间是从奇数位置的数字开始的; 那么奇数位上的|a[i+1]-a[i]|的系数(-1)^(i-l)就为1否则为-1 如果...
阅读全文
摘要:【题目链接】:http://codeforces.com/contest/787/problem/A【题意】 把b一直加a->得到x 把d一直加c->得到y 然后问你x和y可不可能有相同的值. 有的话,输出那个最小的; 【题解】 等价于 令t=(b+u*a-d)%c==0 u为整...
阅读全文
摘要:【题目链接】:http://codeforces.com/contest/791/problem/D【题意】 你可以从树上的节点一次最多走k条边。 (称为跳一次); 树为无权树; 然后问你任意两点之间的条的次数的和为多少; 【题解】 如果k=1的话; 问题就是求任意两点之间的距离...
阅读全文
摘要:【题目链接】:http://www.lydsy.com/JudgeOnline/problem.php?id=1013【题意】 【题解】 /* 考虑圆上的第一个坐标(a1,a2...an); 设球心的坐标为(x1,x2..xn) 则有 (a1-x1)^2+(a...
阅读全文
摘要:【题目链接】:http://codeforces.com/contest/777/problem/A【题意】 奇数次操作交换1,2位置的东西; 偶数此操作交换2,3位置的东西 给你操作的次数,和最后的位置; 问你一开始的位置在哪里. 【题解】 /* 一开始在0位置 1 2...
阅读全文
摘要:【题目链接】:http://www.lydsy.com/JudgeOnline/problem.php?id=1010 【题意】 【题解】 dp[i] = min(dp[i],dp[j]+sqr(sum[i]-sum[j]+i-(j+1)-l)); dp[i] = min(dp[i],dp[j]+s
阅读全文
摘要:【题目链接】:http://www.lydsy.com/JudgeOnline/problem.php?id=1004【题意】 给你sr+sb+sg张牌,(令n=sr+sb+sg),让你把这n张牌染成3种颜色(红蓝绿),且红色sr张,蓝色sb张,绿色sg张; 同时再给你m个变化关系...
阅读全文
摘要:time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mahmoud has n line segments, the i-t...
阅读全文
摘要:Time Limit: 1 second Memory Limit: 128 MB【问题描述】Sramoc(K,M)表示用数字0,1,2,。。。,K-1组成的自然数中能被M整除的最小数。给定K,M,求Sramoc(K,M)。 例如,K=2,M=7时,Sramoc(K,M)=1001。...
阅读全文
摘要:Time Limit: 1 second Memory Limit: 32 MB【问题描述】一个正整数一般可以分为几个互不相同的自然数的,如3=1+2,4=1+3,5=1+4=2+3,6=1+5=2+4,…。现在你的任务是将指定的正整数n分解成若干个互不相同的自然数的和,且使这些自然...
阅读全文
摘要:Time Limit: 1 second Memory Limit: 128 MB【问题描述】一个数列定义如下:f(1) = 1,f(2) = 1,f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7。给定A,B和n的值,要求计算f(n)的 值。 说...
阅读全文
摘要:time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output n hobbits are planning to spend the n...
阅读全文
摘要:time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Every Codeforces user has rating, de...
阅读全文
摘要:time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Bachgold problem is very easy to form...
阅读全文
摘要:time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output After seeing the “ALL YOUR BASE ARE B...
阅读全文
摘要:time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Vladik and Chloe decided to determine...
阅读全文
摘要:time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Little Lesha loves listening to musi...
阅读全文
摘要:time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output There are some beautiful girls in Arp...
阅读全文
摘要:Time Limit: 10 second Memory Limit: 2 MB问题描述 当一个人从银行贷款后,在一段时间内他将不得不每月尝还固定的分期付款。这个问题要求计算机出贷款者向银行支付的利率。假设利率按月累计。Input输入文件 仅一行包含三个用空格隔开的正整数。 第一个整...
阅读全文
摘要:【题目链接】:【题解】 错排公式 f[n] = (n-1)*(f[n-1]+f[n-2]); 这样理解; 要从n-1和n-2递推到n; 假设第n个位置上的数要放在前n-1个位置中的k位置;则有n-1种选择; 则对于第k个位置上原本的元素; 有两种情况; ① k那个元素到第n个位置上...
阅读全文

浙公网安备 33010602011771号