杭电
Fovait
这个作者很懒,什么都没留下…
展开
-
A+BProblem
#include<iostream>using namespace std;int main(){ int a,b; while(cin >> a >> b){ cout << a+b << endl; } return 0;}原创 2021-04-29 06:54:04 · 86 阅读 · 0 评论 -
杭电oj 2009
#include<iostream>#include<algorithm>#include<cmath>using namespace std;int main(){ int n,m; while(cin >> n >> m){ int i; double sum = n; double q = sqrt(n); for(i = 1; i < m; ++i){ sum += q; q = sqrt(q)原创 2021-04-28 22:24:16 · 53 阅读 · 0 评论 -
杭电oj 2039
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>int n;using namespace std;int main(){ cin >> n; int i; for(i = 0; i < n; i++){ double a,b,c; scanf("%lf%lf%lf",&a,&b,&c); if(a + b原创 2021-02-03 21:34:49 · 93 阅读 · 0 评论 -
杭电oj 2036
这题使用鞋带公式#include<iostream>#include<cstdio>#include<cstring>int n,a[1000000],b[1000000];using namespace std;int main(){ while(cin >> n)//输入多边形边数 { if(n == 0)break;//停止计算 int i; for(i = 1; i <= n; i++){//输入x,y cin &g原创 2021-02-03 18:33:16 · 105 阅读 · 0 评论 -
杭电oj 2034
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int main(){ int n,m; while(cin >> m >> n){ int a[120] = {0},b[120] = {0},c[120] = {0}; if(m == 0 && n == 0){//.原创 2021-01-29 22:08:57 · 76 阅读 · 0 评论 -
杭电oj 2033
#include<iostream>#include<cstdio>#include<cmath>#include<string>using namespace std;int main(){ int n; cin >> n; while(n--){ int a,b,c,d,e,f; cin >> a >> b >> c >> d >> e >> f; i原创 2021-01-28 18:20:05 · 84 阅读 · 0 评论 -
杭电oj 2031
考察字符数组和进制转换进制转换类比十进制转换二进制#include<iostream>#include<cstdio>#include<cmath>#include<string>using namespace std;int main(){ int m,n; while(cin >> m >> n){ char x[18] = {'0','1','2','3','4','5','6','7','8','9','A'原创 2021-01-28 18:06:01 · 72 阅读 · 0 评论 -
杭电oj 2029
逐一从开头与末尾比较字符是否相等#include<iostream>#include<cstdio>#include<cmath>#include<string>using namespace std;int main(){ int n; cin >> n; int i,j,k; string x; for( i = 0; i < n; i++){ cin >> x; k = 0; for( j原创 2021-01-28 17:36:38 · 102 阅读 · 0 评论 -
杭电oj 2027
试了3次才通过菜鸡实锤了注意不是最后一行字符串要输出一个空行类似于u:0输入字符串这样#include<iostream>#include<cstdio>#include<string>using namespace std;int main(){ int n;//行数 while(cin >> n){ int i,j; char a[110]; char c = getchar();接收换行 for(i = 0; i <原创 2021-01-25 19:53:05 · 94 阅读 · 0 评论 -
杭电oj 2026
知识点:gets可以接受带空格的字符串scanf和cin不能接受带空格的字符串#include<iostream>#include<cstdio>#include<string>using namespace std;int main(){ char a[100]; while(gets(a)){//输入一行字母 int i; for(i = 0;a[i] != '\0'; i++){//直到末尾结束 if(i == 0){ a[i原创 2021-01-25 19:26:32 · 101 阅读 · 0 评论 -
杭电oj 2025
思路是先找出最大的字符然后再遍历一边数组,更改最大字符的数最后遍历一边数组,最大的字符处单独输出#include<iostream>#include<string.h>#include<cstdio>#include<cmath>#include<string>using namespace std;int main(){ string a; while(cin >> a){ char c = a[0];原创 2021-01-24 21:36:05 · 131 阅读 · 0 评论 -
杭电oj 2023
考点应该是二维数组#include<iostream>#include<cstdio>#include<cmath>using namespace std;int main(){ int n,m; while(cin >> n >> m){ int a[55][10] = {0};//初始成绩 int c[55] = {0};//每个学生总成绩 int d[10] = {0};//所有科目总成绩 int i,j; for(i原创 2021-01-24 12:40:53 · 131 阅读 · 0 评论 -
杭电oj 2019
从0开始到n交换排序 #include<iostream> #include<cstdio> #include<cmath> #include<string> using namespace std; int main(){ while(1){ int n,m; int a[1000] = {0}; cin >> n >> m; if(m == 0 && n == 0)break; i原创 2021-01-21 21:48:41 · 126 阅读 · 0 评论 -
杭电oj 2018
类似于斐波那契数列成熟母牛可以诞下幼牛幼牛会花4年时间成长 #include<iostream> #include<cstdio> #include<cmath> #include<string> using namespace std; int jishu(int x){//这里使用了递归 if(x == 0)return 0; if(x < 4)return x;//前四年没有幼牛长大 if(x >= 4)retur原创 2021-01-21 20:59:35 · 236 阅读 · 0 评论 -
杭电oj 2017
字符数组 循环 判断#include<iostream>#include<cstdio>#include<cmath>#include<string>using namespace std;int main(){ int n; cin >> n; int i,j; char a[100000]; for(i = 0; i < n ; i++){ scanf("%s",a); int count = 0;//总原创 2021-01-21 20:16:28 · 149 阅读 · 0 评论 -
杭电oj 2020
#include#include//c++函数库using namespace std;int main(){int n;int a[100]={0};//开个一百的数组while(~scanf("%d",&n),n){int i,j;for(i = 0;i < n;i++){int b;scanf("%d",&b);a[i] = b;}for(i = 0;i < n - 1;i++){//冒泡法排序for(j = 0;j < n - 1 - i原创 2020-11-15 21:59:00 · 1013 阅读 · 0 评论 -
杭电oj 2010
#include<stdio.h>int main(){int i,j;while(~scanf("%d%d",&i,&j)){int a;int count = 0;for(a = i;a <= j; a++){int o,p,q;o = a % 10;p = a / 100;q = (a - p100) / 10;if(a == ooo + ppp + qq*q){if(count == 1)printf(" “);//第一个输出数 之后为”空原创 2020-11-12 21:05:51 · 145 阅读 · 0 评论 -
杭电oj 2009
#include<stdio.h>#include<math.h>int main(){int i,j;while(~scanf("%d%d",&i,&j)){double a;double sum=0;sum+=i;a=i;for(int p=0;p<j-1;p++){a=sqrt(a);sum+=a;}printf("%.2lf\n",sum);}return 0;}原创 2020-11-12 20:04:13 · 111 阅读 · 0 评论 -
杭电oj 2003
#include<stdio.h>int main(){double a;while(~scanf("%lf",&a)){if(a<0)printf("%.2lf\n",-a);elseprintf("%.2lf\n",a);}return 0;}原创 2020-11-11 10:16:43 · 98 阅读 · 0 评论 -
杭电oj 2002
#include<stdio.h>#define PI 3.1415927int main(){double a;while(~scanf("%lf",&a)){double b=4 * PI * a * a * a / 3;printf("%.3lf\n",b);}return 0;}原创 2020-11-11 10:05:08 · 135 阅读 · 0 评论 -
杭电oj 2001
变量类型要使用double#include<bits/stdc++.h>int main(){double a,b,c,d;while(~scanf("%lf%lf%lf%lf",&a,&b,&c,&d)){double l;l=sqrt((a-c)(a-c)+(b-d)(b-d));printf("%.2lf\n",l);}return 0;}原创 2020-11-11 09:56:54 · 228 阅读 · 0 评论