- 博客(11)
- 收藏
- 关注
原创 洛谷P1135奇怪的电梯
解题思路 a[i][j]表示经过j次传递到达第i号人的方案数 每个人都只能传给左右两边的人 所以每个人也只能接到左右相邻的人的传球即a[i-1],a[i+1] a[i-1][j-1],a[i+1][j-1]分别表示经过j-1次传递到达左右两边人手中的方案数 所以可以得到递推公式a[i][j] = a[i-1][j-1] + a[i+1][j-1] 开始第1号手中,所以经过0次传递到达自己手中。a[...
2019-09-13 16:23:10
292
原创 洛谷P1025数的划分
题目分析 我们设一个数值a[i][j]表示和为i的情况下分为j组有多少种可能 数在划分时可以分为两种情况 1.第一个数为1 2.第一个数不为1 第一种情况 第一个数为1的组合数等于1后面的数的组合数即为a[i - 1][j - 1] 第一个数不为1的组合数,可以由在每个数上加1得到。所以这种情况组合数即为a[i - j][j] 1 2 3 4 5 = 15 2 3 4 5 6 = 20 ...
2019-09-13 12:03:16
205
原创 洛谷P1080国王游戏
题目分析: 我们先从国王后的两个大臣开始看起 第一种情况 left right 0. a0 b0 1. a1 b1 2. a2 b2 第二种情况 left right 0.a0 b0 2.a2 b2 1.a1 b1 所以 第一种情况大臣获得金币的最...
2019-09-12 13:21:29
203
转载 洛谷P1498南蛮图腾
来自:@学无止境 <-----这真的大佬。。。 分形就是自相似,那么最终图腾是由多个与之相似的更小的图腾元素组成。 那么最小的元素是什么? /\ /__\ //观察发现,此为基础组成图形,也是n=1时的图腾 将这个图形向右复制一个: /\ /\ /__\/__\ 再向上复制一个 /\ /__\ /\ /\ ...
2019-09-10 21:32:49
318
原创 洛谷P1010,幂次方
#include<bits/stdc++.h> using namespace std; int pown(int n) { int cnt = 0;//幂数 int num = 1; while(num <= n) { num <<= 1; cnt++; } cnt--; if(cn...
2019-09-09 16:31:21
124
原创 洛谷 P1031 均分纸牌
传送门 解题思路 第一堆牌相差的牌只能由第二堆牌承担(给予或索要) 如果第一堆牌达到要求不动 这时第二堆排变成了第一堆 重复上述操作 当前牌达标便跳过 AC代码 #include<bits/stdc++.h> #define LL long long #define forn(i, n) for(int i = 0;i < n;i++) using namespace std; ...
2019-09-05 20:41:32
123
原创 1214A Optimal Currency Exchange
Optimal Currency Exchange Andrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has n rubles left, and wo...
2019-09-05 17:54:23
311
原创 1213C Book Reading (codeforce)
Book Reading Polycarp is reading a book consisting of n pages numbered from 1 to n. Every time he finishes the page with the number divisible by m, he writes down the last digit of this page number. F...
2019-09-05 17:43:47
215
原创 P1022 计算器的改良
题目背景 NCL是一家专门从事计算器改良与升级的实验室,最近该实验室收到了某公司所委托的一个任务:需要在该公司某型号的计算器上加上解一元一次方程的功能。实验室将这个任务交给了一个刚进入的新手ZL先生。 题目描述 为了很好的完成这个任务,ZLZL先生首先研究了一些一元一次方程的实例: 4+3x=84+3x=8 6a-5+1=2-2a6a−5+1=2−2a -5+12y=0−5+12y=0 ZLZL先...
2019-09-04 21:45:45
164
原创 Codeforces 1213B-Bad Prices
Problem Description: Polycarp analyzes the prices of the new berPhone. At his disposal are the prices for n last days: a1,a2,…,an, where ai is the price of berPhone on the day i. Polycarp considers th...
2019-09-01 21:38:50
646
原创 UVa1589象棋
本题链接:象棋 注意:在UVa提交时过了debug所有测试样例,但是还是一直WA。开始想法是是由scanf("%c %d %d", &c, &a1, &b1);之后使用getchar();吸收回车,之后改成scanf(" %c%d%d", &c, &a1, &b1);使用空格去吸收回车便AC了,如果测试样例都过了就是WA可以试下。 本题思路:使用两个...
2019-08-25 14:43:14
292
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅