算法竞赛入门经典(第二版)----数组和字符串
wang2147483647
这个作者很懒,什么都没留下…
展开
-
UVA 1368(p58)----DNA Consensus String
#include #include #include #include using namespace std; char g[2000][2000],ans[2000]; int anss,t,ch[50],n,m; void solve() { int i,j,k; for(j=1;j<=m;j++) { int maxx=-10000;原创 2016-02-26 00:24:34 · 186 阅读 · 0 评论 -
UVA 1584(p52)----Circular Sequence
#include #include #include using namespace std; int len,t,ans; string st; int cmp(const string& st,int l,int r) { for(int i=0;i<len;i++) { if(st[(l+i)%len]!=st[(r+i)%len]) if (st[(l+原创 2016-02-26 13:32:11 · 258 阅读 · 0 评论 -
UVA 1586(p57)----Molar Mass
#include #include #include #include #include using namespace std; string st,temp; int t,j,n,a[5]; double ans; int change(const string& st) { int l=st.length();n=0; for(int i=l-1;i>=0;i--)原创 2016-02-26 13:33:04 · 222 阅读 · 0 评论 -
UVA 401(p48)----Palindromes
#include using namespace std; const char rev[]= "A 3 HIL JM O 2TUVWXY51SE Z 8 "; const string ans[]= {"is not a palindrome.", "is a regular palindrome.", "is a mirrored string.", "is a mirrored原创 2016-02-25 22:52:29 · 311 阅读 · 0 评论 -
UVA 455(p57)----Periodic Strings
#include #include #include using namespace std; char st[200]; int t,flag,f; int main() { /*freopen("in.in","r",stdin); freopen("out.out","w",stdout);*/ scanf("%d",&t); for(int i=1; i<=原创 2016-02-25 22:59:36 · 330 阅读 · 0 评论 -
UVA 10082(p47)----WERTYU
#include #include #define debu using namespace std; char s[] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"; string st; int main() { #ifdef debug freopen("in.in","r",stdin); #endif // debug原创 2016-02-29 11:12:18 · 261 阅读 · 0 评论 -
UVA 1583(p52)----Digit Generator
#include using namespace std; const int maxn=1e5+50; int ans[maxn]; void prepare() { memset(ans,0,sizeof(ans)); for(int i=0;i<maxn;i++) { int x=i,y=i; while(x>0) {原创 2016-02-29 11:26:17 · 268 阅读 · 0 评论