
随笔
cugzyc
Coding && Reading.
展开
-
字符串比较
比较两个字符串#include<iostream>#include<cstring>#define M 1000000using namespace std;char a[M],b[M];int main(){ int i,j,k,m,n; while(cin>>a>>b) { int flag=1; m=strlen(a); n=strlen...原创 2018-04-07 15:34:40 · 153 阅读 · 0 评论 -
字符串替换
you转化为we #include<bits/stdc++.h> using namespace std; int main() { char a[1005]; while(gets(a)!=NULL) { int l=strlen(a); int i; for(i=0;i<l;i++) { if(a[i]=='y' && a[i+1]...原创 2018-06-12 18:53:01 · 231 阅读 · 0 评论 -
字符串替换升级版(不用考虑两个字符串的长度)
#include<bits/stdc++.h> using namespace std; char s[100]="123123"; char st[100]="456456456"; char store[100]; int main() { char a[10005]; while(gets(a)!=NULL) { memset(store,0,sizeof(store)...原创 2018-06-12 20:32:09 · 348 阅读 · 0 评论 -
验证哥德巴赫猜想
#include<iostream> #include<string.h> using namespace std; bool p[1000005]; void prime() { memset(p,0,sizeof(p)); p[0]=p[1]=1; int i,j; for(i=2;i<=1000005;i++) for(j=2;i*j<=100...原创 2018-06-10 22:10:37 · 432 阅读 · 0 评论 -
优先队列应用测试
#include<bits/stdc++.h> using namespace std; struct node{ int id; int pri; }; bool operator <( const node & a, const node & b) { if(a.pri==b.pri) return a.id>b.id; return a.p...原创 2018-07-27 11:23:43 · 142 阅读 · 0 评论