Codeforces Round #422 (Div. 2)
来源:互联网 发布:java接口的继承 编辑:程序博客网 时间:2024/06/14 11:21
A
a-i'm boring with life
求两个数阶乘的最大公因数
#include<cstdio>#include<iostream>using namespace std;int main(){ int x,y; int temp; scanf("%d%d",&x,&y); if(x<y) { temp=x; x=y; y=temp; } int sum=1; for(int i=1;i<=y;i++) sum=sum*i; printf("%d",sum); return 0;}
B
B. Crossword solving
平移字符串然后比较
#include<cstdio>#include<iostream>#include<cstring>using namespace std;#define inf 1e9int main(){ int pos; int n,m; int cnt[1000]; int Min=inf; bool vis[1000][1000]; char s[1005],t[10005]; scanf("%d%d%s%s",&n,&m,s,t); memset(cnt,0,sizeof(cnt)); memset(vis,0,sizeof(vis)); for(int i=0;i<=m-n;i++) { for(int j=0;j<n;j++) { if(s[j]!=t[i+j]) { cnt[i]++; vis[i][j]=1; } } } for(int i=0;i<=m-n;i++) { if(cnt[i]<Min) { Min=cnt[i]; pos=i; } } printf("%d\n",cnt[pos]); int i; for(i=0;i<m;i++) { if(vis[pos][i]==1) { printf("%d",i+1); break; } } for(int j=i+1;j<m;j++) { if(vis[pos][j]==1) printf(" %d",j+1); } return 0;}
阅读全文
0 0
- Codeforces Round #422 (Div. 2)
- Codeforces Round #422 (Div. 2)
- Codeforces Round #422 (Div. 2)
- Codeforces Round #422 (Div. 2) 题解
- Codeforces Round #422 (Div. 2) 解题报告
- Codeforces Round #422 (Div. 2) C
- Codeforces Round #102 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #103 (Div. 2)
- Codeforces Round #104 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #105 (Div. 2)
- Codeforces Round #107 (Div. 2)
- Codeforces Round #108 (Div. 2)
- Codeforces Round #110 (Div. 2)
- Codeforces Round #122 (Div. 2)
- Codeforces Round #121 (Div. 2)
- Codeforces Round #124 (Div. 2)
- js获取json中的键与值
- acm快速读入方法
- 什么是PYTHON
- 什么是事务
- 项目进度汇报1
- Codeforces Round #422 (Div. 2)
- Spring学习笔记6
- Deep Convolutional Network Cascade for Facial Point Detection实践总结
- DES java后台解密
- hihocoder第158周非法二进制数
- octave语言
- span中内容为数字不折行
- 将excel导入mysql(使用navicat) 填坑
- 【bzoj3697】采药人路径