随笔分类 - 模拟
摘要:problemsolutioncodes#include int p[101], a[101], k, n;long long ans[100001], MIN;int main(){ ans[0]=1; scanf("%d%d",&k,&n); f...
阅读全文
摘要:problemsolutioncodes//不好玩#includeusing namespace std;int n, m, a[30010], r, p;int main(){ cin>>n>>m; for(int i = 1; i 1){ ...
阅读全文
摘要:problem(= =、可读版本)最近,佳佳迷上了一款好玩的小游戏:antbuster。 游戏规则非常简单:在一张地图上,左上角是蚂蚁窝,右下角是蛋糕,蚂蚁会源源不断地从窝里爬出来,试图把蛋糕搬回蚂蚁窝。而你的任务,就是用原始资金以及杀蚂蚁获得的奖金造防御塔,杀掉这些...
阅读全文
摘要:problemsolutioncodes#includeusing namespace std;int n, a[1010], t;int main(){ cin>>n; for(int i = 1; i >x; if(!a[x]){ a[x...
阅读全文
摘要:problemsolutioncodes#include#includeusing namespace std;int N, R, x[1000];int main(){ while(cin>>R>>N && R!=-1 && N!=-1){ fo...
阅读全文
摘要:problemsolutioncodes//模拟即可#include#include#includeusing namespace std;struct node{ int id; string name; int end, peace, paper;/...
阅读全文
摘要:problemsolutioncodes#include#include#includeusing namespace std;const int maxn = 5050;struct node{ int id, score; }a[maxn];int cmp(nod...
阅读全文
摘要:problemsolutioncodes#includeusing namespace std;int main(){ int t = 8, ans = 0; for(int i = 0; i >a>>b; if(a+b > t)t = a+...
阅读全文
摘要:problemsolutioncodes#include#includeusing namespace std;int main(){ string s, ss; while(cin>>ss)s += ss; int a = 0, b = 0; ...
阅读全文
摘要:problemsolutioncodes#include#include#includeusing namespace std;void print(char a, int b){ for(int i = 0; i >n>>m>>k; string s; cin...
阅读全文
摘要:problemsolutioncodes//STL大法好#include#include#includeusing namespace std;queueq;sets;int main(){ int m, n, ans = 0; cin>>m>>n; ...
阅读全文
摘要:problemsolutioncodes#include#include#includeusing namespace std;mapma, mm;string ans;int main(){ bool flag = true; string a, b; ...
阅读全文
摘要:problemtan90solutiontan90codes#includeusing namespace std;int main(){ int flag = 0, t = 0, res = 0; for(int i = 0; i >x; ...
阅读全文
摘要:problem给出n头牛的身高,和m对关系(a[i]与b[i]可以相互看见。即他们中间的牛都比他们矮)。已知最高的牛为第p头,身高为h。求每头牛的身高最大可能是多少。solution计算牛的相对大小关系。 第p头最高h,比他矮的最高一定是h-1,,,所以最后每头牛的身...
阅读全文
摘要:problem给出n个点,每个点有一个价值,问一个边长为r的正方形最大能覆盖多大价值。solution维护二维前缀和即可,复杂度O(n^2)注意代码容易被卡: MLE:空间太大,只能比5000大一点。以及前缀和开成一个,不要用两个数组。 RE:空间太小,,不要开500...
阅读全文
摘要://UVa1593 - Alignment of Code#include#include#include#include#includeusing namespace std;vector >ans;int len[200];void print(string &s...
阅读全文
摘要://253 - Cube painting#include#include#includeusing namespace std;int main(){ string s1; int ans[2][3]; while(cin>>s1){ for(int i = 0;...
阅读全文
摘要://UVa1589 - Xiangqi//WA#include#includeusing namespace std;typedef struct XYZ{ char name; int x,y; XYZ(int x = 0, int y = 0):x(x),y(y)...
阅读全文
摘要://UVa815 - Flooded!//直接模拟,注意考虑临界情况#include#includeusing namespace std;int main(){ //freopen("UVa815.in","r",stdin); int n, m, kase = 1...
阅读全文
摘要://UVa133 - The Dole Queue//Time out#include#define maxn 25using namespace std;int n, k, m, a[maxn];//p为初位置,逆时针走t步,d为-1时顺时针走,返回新位置int g...
阅读全文