
模拟
threeh20
暑假有半个月整个人像死了一样,所以更加明白生命的可贵
展开
-
PAT甲级1001 A+B Format(模拟)
1001 A+B Format (20 分)Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Spe...原创 2019-02-16 15:47:53 · 125 阅读 · 0 评论 -
UVA 12291 Polyomino Composer
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3712#include<bits/stdc++.h>using namespace std;long long er[35];int x[111];int y[...原创 2018-05-11 10:56:44 · 275 阅读 · 0 评论 -
UVA 12289 One-Two-Three
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3710#include<bits/stdc++.h>using namespace std;int main(){ int n; double b; int a...原创 2018-05-11 10:37:18 · 181 阅读 · 0 评论 -
CodeForces 510C Fox And Names
http://codeforces.com/problemset/problem/510/C#include<bits/stdc++.h>using namespace std;int n;int main(){ char a[111][111]; bool vis[33][33]; int ru[33]; int ma[33][33]; int flag=0; wh...原创 2018-05-11 10:34:38 · 200 阅读 · 0 评论 -
CodeForces 510A Fox And Snake
http://codeforces.com/problemset/problem/510/A#include<bits/stdc++.h>using namespace std;int main(){ int n,m; while(cin>>n>>m) { for(int i=1;i<=n;i++) { if(i%2==...原创 2018-05-11 10:27:50 · 180 阅读 · 0 评论 -
ZOJ 3804 YY's Minions
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3804#include<bits/stdc++.h>using namespace std;int ma[55][55];int f,k;struct node{ int x,y,t;}p[2555];int n,m;bool cp(node x,...原创 2018-05-11 10:02:44 · 180 阅读 · 0 评论 -
ZOJ 3798 Abs Problem
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3798#include<iostream>using namespace std;int res[50050];int main(){ int n; while(cin>>n) { int cmp=n%4; int cmpp=(n...原创 2018-05-11 09:59:33 · 246 阅读 · 0 评论 -
CodeForces 102B Sum of Digits
http://codeforces.com/problemset/problem/102/B不停的把一个数位数相加,直到是一个个位数#include<bits/stdc++.h>using namespace std;struct node{ char aa; int da;};char a[111111];bool cp(node x,node y){ return ...原创 2018-05-04 10:44:26 · 279 阅读 · 0 评论 -
CodeForces 101A Homework
http://codeforces.com/problemset/problem/101/A将每个字母出现的次数统计排序,用k开始从小到大开始减就可以了。#include<bits/stdc++.h>using namespace std;struct node{ char aa; int da;};char a[111111];bool cp(node x,node y)...原创 2018-05-04 10:38:17 · 250 阅读 · 0 评论 -
UVA 12290 Counting Game
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3711.#include<bits/stdc++.h>using namespace std;bool bs[700070];int main(){ for(in...原创 2018-05-11 10:59:57 · 216 阅读 · 0 评论 -
ZOJ 3958 Cooking Competition
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3958#include<bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; while(t--) { int n; cin>>n; long lo...原创 2018-05-22 15:33:05 · 203 阅读 · 0 评论 -
HihoCoder 1632 Secret Poems(模拟)
https://hihocoder.com/problemset/problem/1632 将左边的图按顺序输出成右边的图大致思路是左右2个指针去填充。所以要做到知道x,y就知道箭头方向。那么就是看规律了。对于左边这张图,我们可以看出→和↓都在四周出现,之后通过x与y的和的奇偶来判↗和↙5对于右图螺旋线,我们和划一个叉叉 ,把它变成四部分,然后就可以看出规律了。。。类似...原创 2018-11-01 21:57:55 · 284 阅读 · 0 评论 -
HihoCoder 1631 Cats and Fish(贪心+模拟)
https://hihocoder.com/problemset/problem/1631 将吃鱼的速度排序后,然后模拟每一秒内的吃鱼情况用一个数组来记录每个猫是否在吃鱼 #include<bits/stdc++.h>using namespace std;int main(){ int m,n,x; int c[111]; while(...原创 2018-11-01 21:52:58 · 314 阅读 · 0 评论 -
zoj 3829 Known Notation (模拟)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3829 优先将星号看成1 ,并保证乘号的数量是合法即可 #include <bits/stdc++.h>using namespace std;int main(){ int T; scanf("%d",&...原创 2018-10-21 12:57:02 · 245 阅读 · 0 评论 -
hdu 5968 异或密码(预处理)
http://acm.hdu.edu.cn/showproblem.php?pid=5968 因为长度只有100,那么就可以先暴力预处理所有长度的异或和记录结果和长度即可。 #include<bits/stdc++.h>using namespace std;struct node{ int ans; int l;}p[11111];int ma...原创 2018-10-21 12:42:29 · 175 阅读 · 0 评论 -
ZOJ 3960 What Kind of Friends Are You?
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3960#include<bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; while(t--) { int n,q; scanf("%d%d",&n,&...原创 2018-05-28 09:23:51 · 239 阅读 · 0 评论 -
ZOJ 3961 Let's Chat
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3961#include<iostream>#include<algorithm>#include<cstring>#include<cstdio>using namespace std;struct node{ i...原创 2018-05-28 09:23:14 · 135 阅读 · 0 评论 -
ZOJ 3962 Seven Segment Display
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3962#include<bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; long long list[55]={6,2,5,5,4,5,6,3,7,6,6,5,4,5,...原创 2018-05-28 09:22:16 · 187 阅读 · 0 评论 -
ZOJ 3959 Problem Preparation
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3959#include<bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; while(t--) { int n; int a[111]; cin>&g...原创 2018-05-22 15:35:44 · 172 阅读 · 0 评论 -
CodeForces 39J Spelling Check
http://codeforces.com/problemset/problem/39/J仔细想想哪种情况可以去掉一个字母就可以了,注意如果循环里写strlen()的话会超时,要写在外面#include<iostream>#include<cstring>#include<cstdio>using namespace std;char a[1111111...原创 2018-05-04 10:29:18 · 300 阅读 · 0 评论 -
CodeForces 39D Cubical Planet
http://codeforces.com/problemset/problem/39/D看懂题意,只要存在一组对应位置相等即可#include<iostream>#include<algorithm>#include<cstring>using namespace std;int main(){ int a,b,c; int aa,bb,cc;...原创 2018-05-04 10:17:16 · 227 阅读 · 0 评论 -
CodeForces 39A C*++ Calculations
http://codeforces.com/problemset/problem/39/A根据题意,输进来的都是一个常数乘上一个c++ (c是题目给的数),我们可以将其视为一个单元,许多个单元之间用加号或者减号连接,每一个单元的计算先后顺序都是任意的,求最大结果。因为都是c++或者是++c,那么肯定是让减号开头的单元也就是常数是负数的先算,然后再算正的。排个序就可以了。#include<io...原创 2018-05-04 10:12:48 · 283 阅读 · 0 评论 -
2017icpc 北京网络赛 A Visiting Peking University
Visiting Peking University时间限制:1000ms单点时限:1000ms内存限制:256MB描述Ming is going to travel for n days and the date of these days can be represented by n integers: 0, 1, 2, …, n-原创 2017-09-23 20:22:30 · 241 阅读 · 0 评论 -
hdu 6216 A Cubic number and A Cubic Number
http://acm.hdu.edu.cn/showproblem.php?pid=6216#include #include #include #include using namespace std;long long int dp[611111];int main(){ long long int i; for(i=2;i<=原创 2017-09-20 17:53:40 · 167 阅读 · 0 评论 -
poj 3650 The Seven Percent Solution
The Seven Percent SolutionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7908 Accepted: 5323DescriptionUniform Resource Identifiers (or URIs) are strin原创 2017-08-05 21:30:02 · 251 阅读 · 0 评论 -
2017多校4 1011 Time To Get Up
http://acm.hdu.edu.cn/showproblem.php?pid=6077#includeusing namespace std;char a[44][44];int find(int x,int y){ if(a[x][y+1]=='X'&&a[x+1][y]=='X'&&a[x+1][y+3]=='X'&&a[x+3][原创 2017-08-05 21:15:37 · 218 阅读 · 0 评论 -
2017 多校3 1003 Kanade's sum
http://acm.hdu.edu.cn/showproblem.php?pid=6058#includeusing namespace std;int a[666666];int rig[666666];int lef[666666];int main(){ int t; cin>>t; while(t--) {原创 2017-08-05 20:51:14 · 275 阅读 · 0 评论 -
codeforces 840A Leha and Function
http://codeforces.com/problemset/problem/840/A题目意思的算最小期望,给出2行数,第二行代表的是期望计算的概率,只不过是分子部分(可以这么看);然后计算第一行的数字乘以第二行数字的总和最小,将重新排序后的第一行数字输出。其实只要在输入的时候加入一个代表顺序的优先级变量来记录顺序就好了,然后就可以随心所欲的按要求对号入座了。原创 2017-08-19 21:13:17 · 449 阅读 · 0 评论 -
2017CCPC 网络选拔赛 1003 Friend-Graph
http://acm.hdu.edu.cn/showproblem.php?pid=6152给一张图,0代表不是朋友,1代表是朋友,问存不存在至少有三人互相不是朋友或者是互相是朋友的情况。模拟暴力,套三层循环,枚举三个不同的人来判断,注意要剪枝避免重复计算。关键:这道题里 朋友的朋友不是朋友,天哪。。。#include#include#include#incl原创 2017-08-19 20:48:16 · 751 阅读 · 0 评论 -
2017 多校7 1011 Kolakoski
http://acm.hdu.edu.cn/showproblem.php?pid=6130给出一个Kolakoski 数列,该数列中只含有1和2,且定义连续相同的数字为一组数,满足第n项的值等于第n组中数字的个数其实是道模拟题,根据题意打个10000000的表就好。#includeusing namespace std;int a[1原创 2017-08-16 19:14:10 · 341 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 C coconut
很简单的线性模拟,循环模拟,遇到不满足的情况就退出。#include#include#include#include#includeusing namespace std;int main(){ int t; scanf("%d",&t); while(t--) { int city[1111]; int day[1111]; i原创 2017-09-19 21:27:01 · 381 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛 A banana
每个猴子都会喜欢若干种香蕉,每种香蕉都有自己的产地,输出每个猴子能从哪些产地获取自己喜欢的香蕉数据范围很小,所以可以暴力标记每个产地数字出现的情况,按升序输出即可。#include #include #include #include #include #include using namespace std;struct node{ int原创 2017-09-19 21:28:18 · 11804 阅读 · 0 评论 -
Blinds CodeForces - 38C
http://codeforces.com/problemset/problem/38/C给出一个下限以及很多个长度,小于下限的长度可以不用看了,只要从下限到长度最大值遍历,求每个长度除以遍历到的当前长度的整数部分的和的最大值即可#include<bits/stdc++.h>using namespace std;int main(){ int n,l; while(cin&g...原创 2018-04-07 19:27:33 · 177 阅读 · 0 评论 -
2017 ccpc 秦皇岛C Crusaders Quest
https://vjudge.net/contest/203034#problem/C给出一行9个字符,分别是3个g,3个a,3个o,每次操作可以去掉其中的一种字符,并把剩余的字符再连起来,如果去掉的3个字符是连在一起的即算作一次得分,问最多能得多少分。模拟即可,因为结果只有1,2,3 3种情况,模拟去掉的字符种类即可。#incl原创 2017-12-23 19:05:38 · 379 阅读 · 0 评论 -
hdu 4907 Task schedule
http://acm.hdu.edu.cn/showproblem.php?pid=4907#include#include#include#includeusing namespace std; bool nu[222222]; int mi[222222];int main(){ int t; cin>>t; wh原创 2017-11-19 17:59:24 · 236 阅读 · 0 评论 -
hdu 4911 Inversion
http://acm.hdu.edu.cn/showproblem.php?pid=4911#include#include#include #includeusing namespace std;int a[100100],b[100100];long long ans=0;void memery_sort(int left,int mid,in原创 2017-11-19 17:57:04 · 222 阅读 · 0 评论 -
poj 3087 Shuffle'm Up
http://poj.org/problem?id=3087#include#include#include #include#include#includeusing namespace std;map ma;string ans;string a,b,c;bool flag=0; int l;void c原创 2017-11-19 17:55:02 · 169 阅读 · 0 评论 -
poj 1835 宇航员
http://poj.org/problem?id=1835#includeusing namespace std;int dir;int x,y,z;int fac;void mov(char a[],int dis){ if(dir==0) { if(fac==1) { if(a[0]=='l原创 2017-11-19 17:53:22 · 263 阅读 · 0 评论 -
poj 1035 Spell checker
http://poj.org/problem?id=1035#include#includeusing namespace std;char a[11111][22];char b[55][22]; int ai=1,bj=1;bool d1(char a[],char b[]){ int l1=strlen(a);原创 2017-11-11 21:05:37 · 205 阅读 · 0 评论 -
hdu 5933 ArcSoft's Office Rearrangement
http://acm.hdu.edu.cn/showproblem.php?pid=5933#includeusing namespace std;int main(){ int t; cin>>t; int cs=1; while(t--) { int n,k; cin>>n>>k; int a[111111]原创 2017-10-21 11:03:25 · 239 阅读 · 0 评论