自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

遇事不决先卖萌

我们要努力干活,让领导过上好日子!

  • 博客(12)
  • 收藏
  • 关注

原创 2021-05-29 1002 A+B for Polynomials (25 分)

PAT_Advanced Level_10021002 A+B for Polynomials (25 分)#include<stdio.h>int main(void){ //hash int n, N; double a; int i = 0, j = 0, temp = 0, sum_n = 0; double N_i[1010] = {}; for(i = 0; i < 2; i++){ scanf("%d", &n); //n == k

2021-05-29 11:23:38 93

原创 2020-12-22-PTA-弹球距离-递归

弹球距离解法一double dist(double h, double p) { double sum=h, rh, temp=0; rh = p * h; while(rh>TOL) { temp = 2 * rh; sum += temp; h = rh; rh = p * h; } return sum;}解法二double dist(double h, double p) { double rh = p * h; if(rh<TOL) {

2020-12-22 08:58:49 1163

原创 2020-12-21-PTA-数列之和

数列之和#include<stdio.h>int main(void){ int A, N; scanf("%d%d", &A, &N); int arr[N+1], i , tempSum, remainder=0; if(N==0)printf("0"); for(i=0; i<N; i++) { tempSum = A * (N-i) + remainder; arr[i] = tempSum%10; remainder = tem

2020-12-21 17:19:20 147

原创 PTA实验11-2-5链表拼接

链表拼接struct ListNode *mergelists(struct ListNode *list1, struct ListNode *list2) { struct ListNode *p1 = list1, *p2 = list2, *prev = NULL, *pcurrent = NULL, *head = NULL;//p1--1链表,p2--2链表, head记录list1的头节点 if(p1==NULL) { head = p2; } else if(p2 == NULL

2020-12-09 14:55:23 784

原创 链表逆置-递归

PTA实验题11-2-9链表逆置-递归struct ListNode *reverse( struct ListNode *head ){ if(head == NULL || head->next == NULL) { return head; } struct ListNode *newNode = reverse(head->next); /*出递归后,head为进入递归之前的值*/ head->next->next = head;//5->next

2020-12-07 16:19:22 774

原创 PTA-链表学习-----奇数值结点链表

奇数值结点链表解法一struct ListNode *readlist(){ struct ListNode *head = NULL, *p; int data=0; while(scanf("%d", &data)&&data != -1) { struct ListNode *q = (struct ListNode *)malloc(sizeof(struct ListNode));//为节点分配存储空间 if(q!=NULL) { q

2020-12-03 15:48:25 1436

原创 约瑟夫环(Josephus)问题--报数游戏(链表)

报数离开队列游戏#include<stdio.h>#include<stdlib.h>typedef struct Node{ int data; struct Node *next;}Node;Node *createList(int total);void Josephus(struct Node *p1, int total, int from, int count);int main(int argc, char const *argv[]){ i

2020-12-02 19:42:28 269

原创 链表的逆序输出--头插法

头插法struct ListNode *createlist(){ struct ListNode *head = NULL, *newNode = NULL; int a; while(1) { scanf("%d", &a); if(a == -1){ return head; }else{ newNode = (struct ListNode*)malloc(sizeof(struct ListNode)); newNode->data =

2020-12-02 19:38:44 198

原创 PTA-报数游戏

不会做,参考了网上答案+自己理解记录下来以后复习#include <stdio.h>#define MAXN 20void CountOff( int n, int m, int out[] );int main(){ int out[MAXN], n, m; int i; scanf("%d %d", &n, &m); CountOff( n, m, out ); for ( i = 0; i < n; i+

2020-11-28 20:08:25 640

原创 2020-11-22刷题-递归求简单交错幂级数的部分和

题目本题要求实现一个函数,计算下列简单交错幂级数的部分和:​​裁判员测试样例#include <stdio.h>double fn( double x, int n );int main(){ double x; int n; scanf("%lf %d", &x, &n); printf("%.2f\n", fn(x,n)); return 0;}/* 你的代码将被嵌在这里 */解题:double fn(

2020-11-22 22:24:02 196

原创 PTA习题9.5-通讯录排序-------结构体传值,字符串和数字混合输入概念加深

PTA习题9.5-通讯录排序//6223/*3zhang 19850403 13912345678wang 19821020 +86-0571-88018448qian 19840619 13609876543*/#include<stdio.h> #include<stdlib.h>#include<string.h>struct tel_d {//telephone directory电话簿 char name[20]; long int

2020-11-19 18:26:01 567

原创 int main(int argc, char const *argv[])与int main(void)相关疑问

PAT-习题9.4查询书籍代码#include<stdio.h>#include<string.h>struct book_Price{ char name[31]; double price;};int main(int argc, char const *argv[]){ int i=0, n;//n<10,书籍个数 struct book_Price book[11];//书--数组 scanf("%d", &n); getc

2020-11-19 16:32:58 1009 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除