- 博客(8)
- 收藏
- 关注
原创 P1280 莫尔斯电码翻译
题目描述莫尔斯电码表示方式为:a/A .-b/B -...c/C -.-.d/D -..e/E .f/F ..-.g/G --.h/H ....i/I ..j/J .---k/K -.-l/L .-..m/M --n/N -.o/O ---p/P .--.q/Q --.-r/R .-.s/S ...t/T -u/U ..-v/V ...-w/W .--x/X -..-y/Y -.--z/Z --..0 .----1 ..---2 ...--3 .
2021-06-02 13:07:24
420
原创 P1278 蛇形方阵
#include<iostream>#include<stdlib.h>using namespace std;int main(){ int n; int ** p=NULL; while(cin>>n) { //创建二维动态数组 p=(int **)malloc(sizeof(int *)*n); for(int i=0;i<n;i++) { p[i]=(int *)malloc(sizeof(int)*n); }.
2021-06-02 12:35:38
219
原创 P1266 表达式求值
#include<iostream>#include<cstring>using namespace std;int main(){ string str; while(cin>>str) { int len = str.length(); int num = 0; int sum = 0; for(int i=0;i<len;i++) { if(str[i]>='0'&&str[i]<='9').
2021-05-30 18:17:51
112
原创 P1326 分数的值
#include<iostream>#include<cstdio>using namespace std; int main(){ int a,b,c; while(scanf("%d/%d %d",&a,&b,&c) != EOF) { printf("%d.",a/b); a%=b; while(c--) { a*=10; int q=a/b; printf("%d",q); a%=b; .
2021-05-21 08:49:21
137
原创 P1293 放苹果
#include<iostream>using namespace std;int apple(int m,int n){ if(m == 0 || n == 1) { return 1; } if(m < n) { return apple(m,m); } else { return apple(m,n-1) + apple(m-n,n); }}int main(){ int m,n; while(cin >> m >.
2021-05-20 13:00:39
258
原创 P1684 亲和数
#include<iostream>using namespace std;int scd(int a){ int sum = 0; for(int i=1;i<=a/2;i++) { if(a%i == 0) { sum += i; } } return sum;}int main(){ int M,A,B; cin >> M; while(M--) { cin >> A >> B; if(.
2021-05-19 10:11:54
168
原创 P1017 分数加法2
#include<iostream>using namespace std;int cd(int m,int n){ if(m >= n) { for(int i=n;i>=1;i--) { if(m%i == 0 && n%i == 0) { return i; } } } else { for(int i=m;i>=1;i--) { if(m%i == 0 && n%i =.
2021-05-18 19:36:32
74
原创 P1130 All in All
#include<iostream>#include<cstring>using namespace std;int main(){ string s,t; while(cin >> s >>t) { int n = s.length(); int m = t.length(); int i = 0,j = 0; while(i < n && j < m) { if(s[i] == t[j].
2021-05-18 19:08:09
93
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人