首页
博客使用须知
Search
1
沉金工艺介绍
103 阅读
2
板载天线介绍
87 阅读
3
Python-童叟皆懂,一文涵盖你想知道的经典
84 阅读
4
「题解」航电ACM2001-计算两点间的距离
67 阅读
5
单词记忆背诵辅助工具
60 阅读
HarmonyOS
HarmonyOS入门
原创
原创工具
python系列
pip类
知识整理Py
c++
知识整理C
随笔
网页
概览
假日限定
默认分类
proj
登录
Search
标签搜索
原创
c++
题解
pip
python
工作室原创
软件
杭电ACM
NOI
HarmonyOS
pygame
windows
html
网页设计
版权
结构体
调试
安装
后端
开发语言
虹棠包
累计撰写
25
篇文章
累计收到
5
条评论
首页
栏目
HarmonyOS
HarmonyOS入门
原创
原创工具
python系列
pip类
知识整理Py
c++
知识整理C
随笔
网页
概览
假日限定
默认分类
proj
页面
博客使用须知
搜索到
4
篇与
的结果
2023-12-12
「题解」航电ACM2001-计算两点间的距离
Creation:2023/12/10 17:00:27 Problem ID:2001Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem Description输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。Input输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间用空格隔开。Output对于每组输入数据,输出一行,结果保留两位小数。Sample Input0 0 0 1 0 1 1 0Sample Output1.00 1.41AuthorlcySourceC语言程序设计练习(一)Solution用勾股定理然后计算输出即可#include<stdio.h> #include<math.h> int main() { double a,b,c,d; while(scanf("%lf%lf%lf%lf",&a,&b,&c,&d) != EOF) printf("%.2lf\n",sqrt((a-c)*(a-c)+(b-d)*(b-d))); return 0; }
2023年12月12日
67 阅读
0 评论
0 点赞
2023-12-12
「Solution」航电ACM2000-ASCII码排序
Creation:2023/12/10 16:09:49 Problem ID:2000Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem Description输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。Input输入数据有多组,每组占一行,有三个字符组成,之间无空格。Output对于每组输入数据,输出一行,字符中间用一个空格分开。Sample Inputqwe asd zxcSample Outpute q w a d s c x zAuthorlcySourceC语言程序设计练习(一)Solution#include<stdio.h> int main() { char a[3],t;//用一维数组存储 while(scanf("%s",&a) != EOF)//以字符串的方式按行读入 { for(int i=0;i<=1;i++)//冒泡排序 for(int j=i+1;j<=2;j++) { if(a[i]>a[j]) { t = a[i];a[i] = a[j];a[j] = t; } } printf("%c %c %c\n",a[0],a[1],a[2]); } return 0; }
2023年12月12日
27 阅读
0 评论
0 点赞
2023-12-12
「Solution」A+B Problem N-VIII
Creation:2023/12/10 14:31:38 这章的题都挺简单,是对输入输出的练习,直接附答案了。但也欢迎大家评论区留言和讨论~A + B ProblemProblem ID:1000Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionCalculate A + B.InputEach line will contain two integers A and B. Process to end of file.OutputFor each case, output A + B in one line.Sample Input1 1Sample Output2AuthorHDOJSolution注意,这里题目要求是Process to end of file.,故要用EOF判断输入的结束。#include<stdio.h> int main() { int a,b; while(scanf("%d%d",&a,&b) != EOF) printf("%d\n",a+b); return 0; }A+B for Input-Output Practice (I)Problem ID:1089Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionYour task is to Calculate a + b.Too easy?! Of course! I specially designed the problem for acm beginners.You must have found that some problems have the same titles with this one, yes, all these problems were designed for the same aim.InputThe input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.Sample Input1 5 10 20Sample Output6 30AuthorlcySolution#include<stdio.h> int main() { int a,b; while(scanf("%d%d",&a,&b) != EOF) printf("%d\n",a+b); return 0; }A+B for Input-Output Practice (II)Problem ID:1090Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionYour task is to Calculate a + b.InputInput contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line.OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.Sample Input21 510 20Sample Output630AuthorlcySolution#include<stdio.h> int main() { int n,a,b; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d%d",&a,&b); printf("%d\n",a+b); } return 0; }A+B for Input-Output Practice (III)Problem ID:1091Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionYour task is to Calculate a + b.InputInput contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.OutputFor each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input.Sample Input1 5 10 20 0 0Sample Output6 30AuthorlcySolution#include<stdio.h> int main() { int a,b,c; while(true) { scanf("%d%d",&a,&b); if(a ==0 && b==0) break; printf("%d\n",a+b); } return 0; }A+B for Input-Output Practice (IV)Problem ID:1092Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionYour task is to Calculate the sum of some integers.InputInput contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed.OutputFor each group of input integers you should output their sum in one line, and with one line of output for each line in input.Sample Input4 1 2 3 4 5 1 2 3 4 5 0Sample Output10 15AuthorlcySolution#include<stdio.h> int main() { int n,a,sum=0; while(true) { scanf("%d",&n); if(n == 0) break; for(int i=1;i<=n;i++) { scanf("%d",&a); sum += a; } printf("%d\n",sum); sum = 0; } return 0; }A+B for Input-Output Practice (V)Problem ID:1093Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.OutputFor each group of input integers you should output their sum in one line, and with one line of output for each line in input.Sample Input2 4 1 2 3 4 5 1 2 3 4 5Sample Output10 15AuthorlcySolution#include<stdio.h> int main() { int n,m,a,sum=0; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&m); for(int j=1;j<=m;j++) { scanf("%d",&a); sum += a; } printf("%d\n",sum); sum = 0; } return 0; }A+B for Input-Output Practice (VI)Problem ID:1094Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line.OutputFor each test case you should output the sum of N integers in one line, and with one line of output for each line in input.Sample Input4 1 2 3 4 5 1 2 3 4 5Sample Output10 15AuthorlcySolution#include<stdio.h> int main() { int n,a,sum=0; while(scanf("%d",&n) != EOF) { for(int i=1;i<=n;i++) { scanf("%d",&a); sum += a; } printf("%d\n",sum); sum = 0; } return 0; }A+B for Input-Output Practice (VII)Problem ID:1095Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionYour task is to Calculate a + b.InputThe input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.OutputFor each pair of input integers a and b you should output the sum of a and b, and followed by a blank line.Sample Input1 5 10 20Sample Output630AuthorlcySolution#include<stdio.h> int main() { int a,b; while(scanf("%d%d",&a,&b) != EOF) printf("%d\n",a+b); return 0; }A+B for Input-Output Practice (VIII)Problem ID:1096Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionYour task is to calculate the sum of some integers.InputInput contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line.OutputFor each group of input integers you should output their sum in one line, and you must note that there is a blank line between outputs.Sample Input3 4 1 2 3 4 5 1 2 3 4 5 3 1 2 3Sample Output10 15 6AuthorlcySolution#include<stdio.h> int main() { int n,m,a,sum=0; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&m); for(int j=1;j<=m;j++) { scanf("%d",&a); sum += a; } printf("%d\n\n",sum); sum = 0; } return 0; }Sum ProblemProblem ID:1001Time Limit: 1000/500 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Problem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.InputThe input will consist of a series of integers n, one integer per line.OutputFor each case, output SUM(n) in one line, followed by a blank line. You may assume the result will be in the range of 32-bit signed integer.Sample Input1 100Sample Output15050AuthorDOOM IIISolution#include<stdio.h> int main() { int n,sum=0; while(scanf("%d",&n) != EOF) { for(int i=1;i<=n;i++) sum+=i; printf("%d\n\n",sum); sum = 0; } return 0; }
2023年12月12日
29 阅读
0 评论
0 点赞
2023-07-13
「题解」「NOIP1998 普及组」 三连击
好久没做题了啊没想到栽到这了。。。记录于此,警示于己题目背景本题为提交答案题,您可以写程序或手算在本机上算出答案后,直接提交答案文本,也可提交答案生成程序。题目描述将 1,2,…,9 共 9 个数分成 3 组,分别组成 3 个三位数,且使这 3 个三位数构成 1 : 2 : 3 的比例,试求出所有满足条件的 3 个三位数。输入格式无输出格式若干行,每行 3 个数字。按照每行第 1 个数字升序排列。样例 #1样例输入 #1无样例输出 #1192 384 576 * * * ... * * * (剩余部分不予展示)。然后,我非常弱智的写了这个↓#include<stdio.h> int main() { int all[800],tem = 0; for(int i = 1;i <= 9;i++) { for(int j = 1;j <= 9;j++) { for(int k = 1;k <= 9;k++) { all[tem] = i * 100 + j * 10 + k; tem++; } } } for(int i = 1;i <= tem-2;i++) { for(int j = i + 1;j <= tem-1;j++) { for(int k = j + 1;k <= tem;k++) { if(all[i] * 3 == all[j] * 2 && all[j] * 2 == all[k]) printf("%d %d %d\n",all[i],all[j],all[k]); } } } return 0; }其实挺简单的,不解释了,AC代码↓肯定还有更简洁的代码,但。。。懒#include<stdio.h> int dcp[9]; bool find(int n,int tem) { for(int i=1;i<=tem;i++) { if(dcp[i]==n) return true; } return false; } int main() { bool flag=false; int num=192,numt; for(int i = 1;i <= 136;i++) { for(int j=0;j<=10;j++) dcp[j] = 0; if(num*2<=981 && num*3<=981) { numt = num*1000000+num*2000+num*3; for(int tem=1;tem<=9;tem++) { if(find(numt%10,tem)) { flag=true; break; } dcp[tem] = numt%10; if(numt!=0) numt = numt/10; } if(flag) { flag=false; num++; continue; } printf("%d %d %d\n",num,num*2,num*3); } num++; } return 0; }总结:审题不够认真仔细狂妄自大,认为简单题就可以松懈记录于此,警示于己,愿重新开启新的征程!编辑于2023-07-11 23:21:44更新2023-07-13 19:46:18 好吧,还是忍不住翻了下题解,确实有更短的()不过他是把判断叠起来了,也,也算是短吧以下代码来自洛谷用户@WilliamEdward#include <stdio.h> int main() { int a,b,c; for(a=123;a<=333;a++) { b=a*2; c=a*3; if((a/100+a/10%10+a%10+b/100+b/10%10+b%10+c/100+c/10%10+c%10==1+2+3+4+5+6+7+8+9)&&((a/100)*(a/10%10)*(a%10)*(b/100)*(b/10%10)*(b%10)*(c/100)*(c/10%10)*(c%10)==(1)*(2)*(3)*(4)*(5)*(6)*(7)*(8)*(9))) printf("%d %d %d\n",a,b,c); } return 0; }
2023年07月13日
22 阅读
0 评论
0 点赞