UVA
文章平均质量分 59
Minorui
我希望每个人都能以各自的形态,自由生活。而不是千方百计把自己塞进方方正正的模具,压缩成同样形状的罐头。我希望当我年老之后,不会再深夜入睡时,枕头里装满了发霉的梦!
展开
-
UVA 725 Division
思路就是暴力求解;这个题目证明我和大神的差距了,代码不优美,复杂。以至于把问题复杂化,wa不知道问题出在哪。还要多刷题啊!自己的(WA):如果指出错误请评论一下,我不知道错哪了。#includeusing namespace std;int main(){ int n; while(cin>>n,n!=0) { int m;转载 2017-07-20 21:40:44 · 122 阅读 · 0 评论 -
UVA 10474
#include#include#define maxn 10000using namespace std;int a[maxn],b[maxn];int main(){ int n,q,k=1; while(cin>>n>>q,n||q) { for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<q;i++) cin原创 2017-08-05 16:49:17 · 123 阅读 · 0 评论 -
UVA 133
这道题我超时了。思路是没错。但ac不了啊,所以又为刘大大献上膝盖。#include#define maxn 25int n,k,m,a[maxn];int go(int p,int d, int t){ while(t--) { do { p=(p+d+n-1)%n+1; }while(a[p]==0); } return p;}int main()转载 2017-08-04 20:00:35 · 200 阅读 · 0 评论 -
UVA 489
这一题注意几个条件就行了。特殊情况有:如果已经全部猜对了,后面还在继续猜还是win。 试错的机会用完之前猜完才算win。#include#includeusing namespace std;int main(){ int n; while(cin>>n,n!=-1) { char s1[1000],s2[1000]; cin>>s1>>s2; int l原创 2017-08-04 16:46:20 · 193 阅读 · 0 评论 -
UVA 1339
首先说,跟着刘大大的思路写的。排序可以解决这个问题。我是真的想不到。#include#include#includeusing namespace std;int main(){ char s1[101],s2[101]; while(cin>>s1>>s2) { int lengh1=strlen(s1); int lengh2=strlen(s2);原创 2017-08-04 11:57:31 · 229 阅读 · 0 评论 -
UVA 10340
这一题只要从前到后扫描一遍就行了#include#include#define max 100005using namespace std;char s1[max],s2[max];int main(){ while(cin>>s1>>s2) { int lengh1=strlen(s1); int lengh2=strlen(s2); int p=0; int原创 2017-08-03 17:01:50 · 135 阅读 · 0 评论 -
UVA 1368
#includeusing namespace std;struct p{ int a,c,g,t;}g[1001]={{0,0,0,0}};int main(){ int n; cin>>n; while(n--) { int a,b; cin>>a>>b; char s[51][1001]; for(int i=0;i<a;i++) {原创 2017-08-03 15:51:52 · 170 阅读 · 0 评论 -
UVA 232
这道题我交了8 9次,终于ac。问题出在格式上:%03d;有了这个不用加空格了,开始03d没加就直接加两空格。QAQ#include#include#includeusing namespace std;int main(){ int m,n,k=0; while(cin>>m,m!=0) { cin>>n; char s[11][11]; for(int i=0原创 2017-08-03 10:50:00 · 138 阅读 · 0 评论 -
UVA 227
这一题,不难。最多就是格式麻烦一点。我的代码可能有点乱。 #include int main(){ char s[6][6]; int k=0; while(gets(s[0]),s[0][0]!='Z') { for(int i=1;i<5;i++) gets(s[i]);原创 2017-08-03 08:25:49 · 153 阅读 · 0 评论 -
HDU 455
这一题虽然简单,可我还是花了蛮长的时间AC。还是太菜了。但我感觉我的代码是简单的,对于那些两层循环的来说。#include#includeusing namespace std;int Less(const char* s,int x,int y){ int lengh=strlen(s); for(int i=0;(x+i)<lengh;i++) { if(s[x+i原创 2017-07-31 10:37:35 · 135 阅读 · 0 评论 -
UVA 1225
#include#includeusing namespace std;int main(){ int n; while(cin>>n) { int N; while(n--) { cin>>N; int a[11]; memset(a,0,sizeof(a)); for(int i=1;i<=N;i++) { int j=i;原创 2017-07-31 08:38:46 · 110 阅读 · 0 评论 -
UVA 1586
我是用的continue:#include#includeusing namespace std;int main(){ int T; cin>>T; while(T--) { char c[85]; double sum=0; cin>>c; int lengh=strlen(c); for(int i=0;i<lengh;) { if(c[原创 2017-07-30 22:19:52 · 109 阅读 · 0 评论 -
UVA 11059 Maximum Product
Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the maximum positive product involving consecutive terms of S. If you cannot find a positive sequence,y原创 2017-07-21 08:52:25 · 166 阅读 · 0 评论 -
UVA 101
还不会,先记着;#include#include#includeusing namespace std;const int maxn=30;int n;vectorpile[maxn];void find_block(int a,int& p,int& h){ for(p=0;p<n;p++) for(h=0;h<pile[p].size();h++) i转载 2017-08-05 17:38:14 · 160 阅读 · 0 评论