
模拟
西瓜不甜不甜不甜
这个作者很懒,什么都没留下…
展开
-
【CodeForces】622D - Optimal Number Permutation
http://codeforces.com/problemset/problem/622/D使得S尽可能小。对于任意n,都存在di与(n-i)的差值为0。输入是6: 1 3 5 5 3 1 2 4 6 4 2 6输入是7: 1 3 5 7 5 3 1 2 4 6 6 4 2 7n最后放空缺的两个位置,剩下的从小到大放,奇数放左边,偶数放右边。#include <bits/stdc++.h>us原创 2017-08-17 00:25:10 · 240 阅读 · 0 评论 -
USACO 2018 February Contest, Bronze 3 Taming the Herd 模拟
http://www.usaco.org/index.php?page=viewproblem2&cpid=809注意处理第一天的不规范记录和不合理记录。#include <bits/stdc++.h>using namespace std;const int maxn=1000005;int n;int a[maxn];int main(){ ...原创 2018-05-12 20:00:31 · 649 阅读 · 0 评论 -
历届试题 小计算器
http://lx.lanqiao.cn/problem.page?gpid=T459#include <bits/stdc++.h>using namespace std;typedef long long LL;int n;string order;string Left,Right,oper;string Hex="10";//任意进制转换为十进制 ...原创 2018-05-04 17:13:08 · 1343 阅读 · 0 评论 -
算法提高 最大乘积 模拟
http://lx.lanqiao.cn/problem.page?gpid=T136#include <bits/stdc++.h>using namespace std;const int maxn=20;const int INF=0x3f3f3f3f;int a[maxn];int n,m;int main(){ int T; cin &g...原创 2018-03-13 20:36:56 · 227 阅读 · 0 评论 -
codeforces 931B - World Cup 模拟
http://codeforces.com/contest/931/problem/B足球联赛,有n支队伍,1和2打,3和4打,赢得晋级。现给出两支队伍的序号,若两支队伍足够强,他们能否会师决赛,若不能,会在第几轮见面?在纸上试着模拟一下,比如1和2的winner下轮成为1,3和4的winner下轮成为2,以此类推。#include <bits/stdc++.h>u...原创 2018-03-06 18:19:58 · 259 阅读 · 0 评论 -
codeforces 931A - Friends Meeting 模拟
http://codeforces.com/contest/931/problem/A数轴上有两人分别在点a,b,人每走一下增加一点疲劳值,且递增,如左1,左1,左1,疲劳值为1+2+3=6。两个人都能走,现希望两人碰面,且求最小疲劳值之和。取两人中点,直接计算。#include <bits/stdc++.h>using namespace std;int n,a,...原创 2018-03-06 18:13:44 · 267 阅读 · 0 评论 -
【Codeforces】899 B - Months and Years 模拟
http://codeforces.com/contest/899/problem/B给连续的N个月,问是否存在这样的连续月份。注意,不会有连续的两个闰年。#include <bits/stdc++.h>using namespace std;int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};int n;int...原创 2018-03-04 10:04:50 · 201 阅读 · 0 评论 -
codeforces 940 b.Our Tanya is Crying Out Loud 暴力
http://codeforces.com/contest/940/problem/B一个数n,每次可以花费b代价把它除以k(如果k|n),或者花费a的代价把它减一。问把这个数变成1的最少代价。这种记得暴力直接算,不要想到bfs去了#include <iostream>#include <cstdio>#include <cmath>#incl...原创 2018-03-04 19:09:34 · 220 阅读 · 0 评论 -
蓝桥 日期计算
http://lx.lanqiao.cn/problem.page?gpid=T265#include <iostream>#include <algorithm>#include <map>#include <queue>#include <cstring>using namespace std;int M[13]={...原创 2018-03-08 18:35:23 · 209 阅读 · 0 评论 -
【POJ】3087-Shuffle'm Up 模拟
给定两个长度为len的字符串s1和s2, 接着给出一个长度为len*2的字符串s12。将字符串s1和s2通过一定的变换变成s12,找到变换次数变换规则如下:假设s1=12345,s2=67890变换后的序列 s=6172839405如果s和s12完全相等那么输出变换次数如果不完全相等,s的前半部分作为s1,后半部分作为s2,重复上述过程。 首先输出处理数据组的编号(编号从...原创 2018-02-28 16:30:12 · 235 阅读 · 0 评论 -
codeforces 944B - Laboratory Work
http://codeforces.com/contest/944/problem/B#include <bits/stdc++.h>using namespace std;const int INF=99999999;int n;int a[100005];int num[3];int x,y,z;int ans=INF;int Min=INF;int ma...转载 2018-03-06 18:45:50 · 3045 阅读 · 0 评论 -
codeforces 944C - Peculiar apple-tree
http://codeforces.com/contest/931/problem/C一棵倒着的树,每个节点都有果子,每经过1s果子都会向下一节点掉落,若有两个果子同时掉到同一个节点,则两个果子都消失。每1s我们都可以从节点1收集1个果子,1是树根,现给出2-n节点指向的节点,求可收集多少果子。抽象化,求出每个节点距离1(树根)的距离。例如距离为2的节点的果子将在第2s掉落到节点1,先求出...原创 2018-03-06 18:30:44 · 551 阅读 · 0 评论 -
【POJ】3185-The Water Bowls 模拟
http://poj.org/problem?id=3185将一列碗翻成口朝上,一把下去可能同时反转3个或2个(首尾),求最小翻转次数。#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;int a[21]={0};int f[21]={0};int ans=1原创 2017-10-31 10:50:47 · 325 阅读 · 0 评论 -
【CodeForces】691C - Exponential notation
http://codeforces.com/problemset/problem/691/C给定一个长度为N的数字,转化为 标准的科学计数法形式。 N最大可达1e6。要考虑前置0 和 后置 0 的特殊情况。 当指数为0 的时候,不输出指数部分。 x=0; x∈(0,1),这种情况下指数部分为-1; x 为整数,这种情况主要是处理不存在小数点的情况,其他情况输入都肯定包含小数点的; x∈原创 2017-08-24 13:00:16 · 260 阅读 · 0 评论 -
【CodeForces】691B - s-palindrome
http://codeforces.com/problemset/problem/691/B确定给定字符串是否镜面对称。#include <bits/stdc++.h>using namespace std;char a[]="AbdHIMOopqTUVvWwXxY";char b[]="AdbHIMOoqpTUVvWwXxY";char m[300];string s;int main()原创 2017-08-24 12:47:59 · 298 阅读 · 0 评论 -
【CodeForces】678B - The Same Calendar
http://codeforces.com/problemset/problem/678/B给定一个年份,求下一个与给定年份完全相同的年份。 完全相同指该年的第一天是周几与当前年是周几完全一样,而且必须是闰年和闰年或者平年和平年。#include <bits/stdc++.h>using namespace std;int y,Y;int d=0;bool is(int y){ if原创 2017-08-24 12:44:46 · 425 阅读 · 0 评论 -
【CodeForces】710C - Magic Odd Square 找规律
http://codeforces.com/problemset/problem/710/C给一个N,有1到n^2,构成n阶矩阵,每行每列的和都是奇数。 输出这个矩阵。找规律。 Input 1 Output 1 Input 3 Output 2 1 4 3 5 7 6 9 8中间是一个右转45度的正方形,里面都是奇数。 依次类推。#include <bits/stdc++.h原创 2017-08-27 22:39:13 · 251 阅读 · 0 评论 -
【CodeForces】702D - Road to Post Office 模拟,初中数学题
http://codeforces.com/problemset/problem/702/D去邮局取东西,从家到达邮局的距离为d, 它可以选择步行或者开车,车每走 k 公里就要花费 t秒修一次才可以继续开,车每公里花费 a秒,步行每公里花费 b秒。依次给出d, k, a, b, t。问最少需要花费多少时间到达邮局。车刚开始时是好的。初中数学题。#include <bits/stdc++.h>usi原创 2017-08-27 22:36:13 · 243 阅读 · 0 评论 -
USACO 2018 February Contest, Bronze 3. Family Tree 模拟
http://www.usaco.org/index.php?page=viewproblem2&cpid=833&lang=zh模拟就完事了#include <bits/stdc++.h>using namespace std;const int maxn=105;const int INF=1<<30;int n;string da...原创 2018-05-12 21:32:54 · 633 阅读 · 0 评论