- 博客(28)
- 资源 (13)
- 问答 (25)
- 收藏
- 关注
原创 ceil
就是向上取整在这里插入代码片#include<stdio.h>#include<math.h>int main(void){ double a = 34.4; printf("%.2f",ceil(a)); return 0;}上图:
2020-01-11 02:08:31 215
原创 floor
就是向下取整在这里插入代码片#include<stdio.h>#include<math.h>int main(void){ double a = 34.4; printf("%.2f",floor(a)); return 0;}上图
2020-01-11 02:06:00 219
原创 计算得分(给出一个由O和X组成的串,统计得分,每个O得分为目前连续出现的O的个数,X的得分为0。例如OOXXOXXOOO的得分为1+2+0+0+1+0+0+1+2+3)
给出一个由O和X组成的串,统计得分,每个O得分为目前连续出现的O的个数,X的得分为0。例如OOXXOXXOOO的得分为1+2+0+0+1+0+0+1+2+3在这里插入代码片#include<stdio.h>#include<string.h>#define maxn 100int main(void) { int n; scanf("%d",&n);...
2020-01-10 17:58:36 6286
原创 生成元
来自算法竞赛 入门经典在这里插入代码片#include<stdio.h>#include<string.h>#define maxn 100005int ans[maxn];int main(void){ int T,n; memset(ans,0,sizeof(ans)); for(int m = 1;m < maxn;m++) { int...
2020-01-10 16:40:26 274
原创 环状序列排序
来自算法竞赛 入门经典在这里插入代码片#include<stdio.h>#include<string.h>#define maxn 105int less(const char *s,int p,int q){ int n = strlen(s); for(int i = 0;i < n;i++) { if(s[(p + i) % n] != ...
2020-01-10 16:30:58 569
原创 倒三角形
在这里插入代码片#include<stdio.h>int main(void) { int n,a,b,i; while(scanf("%d",&n) != EOF) { int v = n; for(i = 0; i < n; i++) { for(b = i; b > 0; b--) { printf(" ");...
2020-01-09 20:13:40 211
原创 计算圆周率/4,精确到1e-6
在这里插入代码片#include<stdio.h>int main(void){ double sum = 0; do { static int i = -1; i++; double term = 1.0 / (i * 2 + 1); if(i % 2 == 0) { sum += term; } else { sum -= t...
2020-01-09 17:02:49 688
原创 输出正弦 余弦
在这里插入代码片#include<stdio.h>#include<math.h>int main(void){ const double pi = acos(-1.0);//pi = 3.141592 printf("%.3f %.3f",sin(pi / 4.0),cos(pi / 4.0));//输出正弦 余弦 return 0;}...
2020-01-09 16:40:48 440
原创 鸡兔同笼
来自 算法竞赛入门经典在这里插入代码片#include<stdio.h>int main(void){ int a,b,n,m; scanf("%d%d",&n,&m);//输入头数和腿数 a = (4 * n - m) / 2; b = n - a; if(m % 2 == 1 || a < 0 || b < 0) { print...
2020-01-09 16:14:03 177
原创 变量交换
来自算法竞赛在这里插入代码片#include<stdio.h>#include<math.h>int main(void){ int a,b; scanf("%d%d",&a,&b); a = a + b; b = a - b; a = a - b; printf("%d %d",a,b); return 0; }...
2020-01-09 16:01:00 137
原创 计算圆柱面积
来自算法竞赛在这里插入代码片#include<stdio.h>#include<math.h>int main(void){ const double pi = acos(0.9);//尽量用const关键字声明常数 double r,h,s1,s2,s; scanf("%lf%lf",&r,&h); s1 = pi * r * r; ...
2020-01-09 15:55:32 214
原创 童年生活二三事
DescriptionRedraiment小时候走路喜欢蹦蹦跳跳,他最喜欢在楼梯上跳来跳去。 但年幼的他一次只能走上一阶或者一下子蹦上两阶。 现在一共有N阶台阶,请你计算一下Redraiment从第0阶到第N阶共有几种走法。Input输入包括多组数据。 每组数据包括一行:N(1≤N≤40)。 输入以0结束。Output对应每个输入包括一个输出。 为redraiment到达第n阶不同走法的...
2020-01-09 00:35:47 285
原创 unsigned
在这里插入代码片#include <stdio.h>int main(void) { unsigned int i = 5; int j = -10; if( (i + j) > 0 ) { printf("i + j > 0\n"); } else { printf("i + j <= 0\n"); } printf("%d",...
2020-01-07 18:56:29 258
原创 nonlocal
在这里插入代码片def tester(start): state = start def nested(label): nonlocal state print(label,state) state += 1 return nested#return跟.c返回方式很像F = tester(0)F('spam')...
2020-01-07 01:31:33 161
原创 id
id应该是求地址的在这里插入代码片x = 9print(id(x))def fun1(): x = 5 print(id(x)) def fun2(): x = 8 #print(x) print(id(x)) fun2()fun1() ``` ![在这里插入图片描述](https:/...
2020-01-07 00:52:46 159
原创 global
global 在函数内部修改全局变量在这里插入代码片count = 5def myfun(): count = 10 print(count)myfun()print(count)#运行结果:#10#5在这里插入代码片count = 5def myfun(): global count count = 10 print(count)...
2020-01-07 00:39:41 219
原创 计算器实验程序
在这里插入代码片#include <stdio.h>int main(){float x,y;char op;printf("请输入算式:\n");scanf("%f%c%f",&x,&op,&y);switch(op){case '+': printf("%.2f%c%.2f=%.2f\n",x,op,y,x+y); break;case...
2020-01-05 21:06:56 490
原创 关于for循环
在这里插入代码片#include<stdio.h>int main(void){ int x = 1,y = 1; for(;y++<8;)//相当于y+1后进入下一步,而y++;y<8,相当于进入下一步在+1 y = ((x+=y,x++),x++); printf("x = %d,y = %d",x,y); return 0; } ...
2020-01-03 20:35:52 196
原创 C语言将数据写入链表,将链表写入文件,再将文件中的内容读出
在这里插入代码片#include<stdio.h>#include<stdlib.h>#include<string.h>struct cj { char xh[10]; char name[10]; int gs; int cx; struct cj *next;};typedef struct cj jj,*listlink;void...
2020-01-03 20:18:29 11384 4
原创 输出4*5矩阵
在这里插入代码片#include<stdio.h>int main(void) { int i, j; scanf("%d",&j); for(i = 1; i <= j; i++) { printf("=",i); if(i % 5 == 0) { printf(" "); } } return 0;}#include<stdi...
2020-01-02 21:55:11 822
原创 求斐波那契数列的前n个数
在这里插入代码片#include<stdio.h>int main(void) { int i, n,x1,x2,x3 ; scanf("%d",&n); x1 = 1; x2 = 1; if(n == 1) { printf("%d ",x1); } if(n == 2) { printf("%d %d ",x1,x2); } else { p...
2020-01-02 21:51:31 1837
原创 求n以内的素数
在这里插入代码片#include<stdio.h>int main(void) { int i,n,m,k; scanf("%d",&n); for(i = 2; i < n; i++) { k = 1; for(m = 2; m <= i; m++) { if(i == m) { continue; } if(i % ...
2020-01-02 21:50:18 314
原创 敲七
在这里插入代码片#include<iostream>using namespace std;int main() { int N, i; while(cin>>N||N>=1||N<=30000) { for(i = 1; i<= N; i++) { if(i % 7 == 0||i % 10 == 7||i / 100 == 7||i...
2020-01-02 21:49:14 462
原创 remove pop del
remove:在这里插入代码片ss = ['a','b','c','d','e']ss.remove('b')#移除b,而且是在列表中存在的元素,不然会出错print(ss)#输出了ssss.remove('b')出错print(ss)在这里插入代码片ss = ['a','b','c','d','e']ss.pop(1)#移除bprint(ss)ss.pop(2)#移除d...
2020-01-02 16:16:29 169
原创 choice
在这里插入代码片import randomss = ['a','b','c','d','e']print(random.choice(ss))随机输出一个元素。
2020-01-02 15:49:24 220
原创 append extend insert
append :在这里插入代码片numble = [1,2,3,4,5]numble.append(6)print(numble)extend:在这里插入代码片numble = [1,2,3,4,5]numble.extend([3,4,5,2,6,7,9])print(numble)insert:在这里插入代码片numble = [1,2,3,4,5]numbl...
2020-01-02 15:34:46 222
原创 range
range 用法:1:range(stop)2: range(start,stop)3:在这里插入代码片range(start,stop,step)来看看分别的使用方法1:在这里插入代码片
2020-01-02 01:12:46 128
原创 文件(源码)
在这里插入代码片#include<stdio.h>#include<stdlib.h>#include<string.h>#define N 100//#define NULL 0typedef struct employee{ char num[N];//工号 char name[N];//姓名 ch...
2020-01-01 14:10:34 265
django2.7z
2021-01-14
djangoProject11.zip
2020-10-22
http报文头部设置httponly之后js脚本就不能获取cookie了吗?
2022-09-26
服务器中Etag存放在哪里?
2022-09-25
bean的延迟初始化
2022-05-04
Setter注入的问题
2022-05-03
websocket可以使用sctp作为应用层协议吗
2022-05-01
sctp如何保证数据的可靠传输?
2022-05-01
socket返回数据失败
2022-04-27
spring中的beanDefinitionMap加锁问题。
2022-04-24
在静态代码块中进行AADemo_5.class.getClass();操作有什么用?
2022-04-23
今天在看Mybatis的视频时,看到了一个弹幕,不知道我的理解对不对。
2022-04-18
关于String的intern
2022-04-14
RabbitMq消费者多次消费同一条数据
2022-04-08
springboot 使用redis构造一个分布式锁,如何定时刷新过期时间。
2022-04-06
请问java如何创建一个bit[] ?
2022-04-06
请问java程序员应该刷leetCode中的哪些算法题?
2022-04-05
请问刷算法题对Java程序员有什么提升
2022-04-05
关于@Transactional的疑惑
2022-03-31
我想要找个师傅带我?
2022-03-16
为什么我使用了范型,输出结果却不是想要的结果?
2022-03-11
volatile在高并发环境下能保证可见性和指令重拍吗?
2022-03-10
idea中的target文件夹,是类加载器的文件夹吗
2022-03-06
打开IDEA出现这种情况?
2022-03-05
为什么ArrayList构造时是{},输出却是[]
2022-03-04
django 原生user中的字段
2021-05-12
django设置了全站缓存后,配置etag无效,请问如何解决?
2021-05-10
<input type=file> 无法上传文件
2020-10-29
TA创建的收藏夹 TA关注的收藏夹
TA关注的人