Shirlies
宁静专注认真的程序媛~
posts - 222,comments - 49,views - 71万

随笔分类 -  acm_暴力求解法

uva 729
摘要:#include <iostream>#include <algorithm>using namespace std;int main(){int t;cin>>t;while(t--){int n,m;cin>>n>>m;char s[20];for(int i=n-1;i>=0;i--){if(n-i<=m)s[i]='1';elses[i]='0';}do{for(int i=0;i<n;i++)cout<<s[i];cout<<endl;}while(n 阅读全文
posted @ 2012-02-05 19:12 Shirlies 阅读(380) 评论(0) 推荐(0) 编辑
uva 10098
摘要:#include <iostream>#include <algorithm>#include <cstring>using namespace std;int main(){int t;cin>>t;while(t--){char s[20];cin>>s;int len=strlen(s);sort(s,s+len);do{cout<<s<<endl;}while(next_permutation(s,s+len));cout<<endl;}return 0;} 阅读全文
posted @ 2012-02-05 18:45 Shirlies 阅读(248) 评论(0) 推荐(0) 编辑
uva 146
摘要:感触:STL真好用~~~#include <iostream>#include <algorithm>#include <cstring>using namespace std;int main(){char s[60];cin>>s;while(s[0]!='#'){int len=strlen(s);if(next_permutation(s,s+len)){cout<<s<<endl;}else{cout<<"No Successor"<<endl;}cin 阅读全文
posted @ 2012-02-05 17:47 Shirlies 阅读(220) 评论(0) 推荐(0) 编辑
uva 11205
摘要:英文一大串,磨死人啊~~~题目大致是想说:找到一个P位的二进制数和给的二进制数与,得到的n个二进制数是不同的,但是呢,这个p位的二进制数1的个数要最小就是了(自己的理解)代码如下://#define LOCAL#include "stdio.h"#include "string.h"int p[150];int s[150][20];int sf[150];int differ(int *p,int m){int i,j;for(i=0;i<m;i++){for(j=i+1;j<m;j++){if(p[i]==p[j])return 0;}} 阅读全文
posted @ 2012-02-05 16:20 Shirlies 阅读(451) 评论(0) 推荐(0) 编辑
UVa 10167
摘要:#include <iostream>#include <string>using namespace std;int coord[120][2];int main(){int n;cin>>n;while(n){for(int i=0;i<(n<<1);i++){cin>>coord[i][0]>>coord[i][1];}for(int i=-500;i<=500;i++)//在vc6中这样定义i是错的,然而在DEV c++和GCC中还必须得这样,否则在uva上提交会编译错误{int re=1;for(in 阅读全文
posted @ 2012-02-05 10:00 Shirlies 阅读(363) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示