![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
codeup
tianxiawuti
这个作者很懒,什么都没留下…
展开
-
链表查找(线性表)
#include<stdio.h>struct node{ node* next; int data;};int main(){ int n,key; while(scanf("%d",&key)!=EOF){ scanf("%d",&n); node* head=new node; ...原创 2019-11-10 23:29:34 · 306 阅读 · 0 评论 -
sort
直接定义结构体数组然后用sort函数可以AC#include<cstdio>#include<algorithm>using namespace std;const int maxn=1000000;struct stu{ int num; int score;}arr[maxn];bool cmp(stu a,stu b){ r...原创 2019-11-10 20:47:32 · 248 阅读 · 0 评论 -
括号匹配
#include<iostream>#include<cstdio>#include<stack>#include<string>using namespace std;string str;stack<char> s;bool test(){ for(int i=0;i<str.length();i++...原创 2019-11-09 00:02:53 · 176 阅读 · 0 评论 -
Day of Week
题意:输出日期对应的星期#include<iostream>#include<string>using namespace std;int getDate(int y,int m,int d){ if(m==1||m==2){ m+=12; y--; } //注意写成()+1,如果不加大括号会错 ...原创 2019-11-03 16:29:28 · 144 阅读 · 0 评论 -
日期累加
#include<stdio.h>int month[13][2]={ {0,0},{31,31},{28,29},{31,31},{30,30},{31,31},{30,30},{31,31},{31,31},{30,30},{31,31},{30,30},{31,31}};int isLeap(int year){ if((year%400==0)||(yea...原创 2019-11-03 16:00:40 · 129 阅读 · 0 评论 -
打印日期
#include<stdio.h>int month[13][2]={ {0,0},{31,31},{28,29},{31,31},{30,30},{31,31},{30,30},{31,31},{31,31},{30,30},{31,31},{30,30},{31,31}};int isLeap(int year){ if((year%400==0)||(yea...原创 2019-11-03 09:20:49 · 124 阅读 · 0 评论 -
沙漏图形
#include<stdio.h>int main(){ int n; while(scanf("%d",&n)!=EOF){ //上面 for(int i=1;i<=n;i++){ for(int j=1;j<=i-1;j++){ printf(" ");...原创 2019-11-02 23:42:38 · 252 阅读 · 0 评论 -
Hello World for U
#include<stdio.h>#include<string.h>int main(){ int len,side,space; char a[100]; while(scanf("%s",a)!=EOF){ len=strlen(a); side=(len+2)/3; space=le...原创 2019-11-02 23:12:35 · 371 阅读 · 0 评论 -
查找学生信息
#include<stdio.h>#include<string.h>struct stu{ char num[100]; char name[100]; char sex[20]; int age;}arr[1010];int main(){ char temp[20]; int m; int n; ...原创 2019-10-31 16:06:51 · 203 阅读 · 0 评论 -
A+B和C
#include<stdio.h>int main(){ int n; long long a,b,c; scanf("%d",&n); for(int i=0;i<n;i++){ scanf("%lld %lld %lld",&a,&b,&c); if(a+b>c){ printf("Case #%d: true...原创 2019-10-30 23:16:38 · 196 阅读 · 0 评论 -
特殊乘法
#include<stdio.h>#include<string.h>int main(){ int len1,len2,sum; char ch1[11],ch2[11]; while(scanf("%s %s",ch1,ch2)!=EOF){ len1=strlen(ch1); len2=strlen(ch2); ...原创 2019-10-30 21:47:41 · 92 阅读 · 0 评论 -
A+B
#include<stdio.h>int main(){ char begin1[11],begin2[11]; int i1,j1; int i2,j2; int m,n; while(scanf("%s %s",begin1,begin2)!=EOF){ char last1[11]={'\0'},last2[11]={'\...原创 2019-10-30 21:33:08 · 102 阅读 · 0 评论 -
剩下的树
#include<stdio.h>#include<string.h>int arr[10010];int main(){ int sum; int L,M; int front,base; while(scanf("%d %d",&L,&M)){ if(L==0&&M==0){ ...原创 2019-10-30 20:52:32 · 95 阅读 · 0 评论 -
结构体指针
#include<stdio.h>struct student{ int num; char name[10]; int as; int bs; int cs;}arr[5];void input(struct student *p,int len){ int i; for(i=0;i<len;i++){ ...原创 2019-10-30 09:12:13 · 95 阅读 · 0 评论 -
共用体
#include<stdio.h>#include<stdlib.h>struct { int num; char name[10]; char sex; char job; union{ int class; char position[10]; }category;}arr[100]...原创 2019-10-30 08:42:50 · 128 阅读 · 0 评论 -
统计得票
#include<stdio.h>#include<string.h>struct person{ char name[20]; int count;}arr[3]={"Li",0,"Zhang",0,"Fun",0};int main(){ int n; scanf("%d",&n); char ch[20]; while(n--){ s...原创 2019-10-29 23:22:00 · 152 阅读 · 0 评论 -
复制字符串当中的元音字母
要注意的一点是拼接’\0’,#include<stdio.h>#include<string.h>void vowels(char s1[],char s2[]){ int n=0; int len=strlen(s1); for(int i=0;i<len;i++){ if(s1[i]=='a'||s1[i]=='e'||s1[i]=='i'||s...原创 2019-10-29 12:21:45 · 191 阅读 · 0 评论 -
字符串比较
#include<stdio.h>#include<string.h>int main(){ char ch1[50],ch2[50]; gets(ch1); gets(ch2); int n1=strlen(ch1); int n2=strlen(ch2); int i,j; for(i=0,j=0;i<n1&&j<n2...原创 2019-10-29 11:47:12 · 95 阅读 · 0 评论 -
解密
主要的思路是利用ASCII码的和的规律#include<stdio.h>#include<string.h>int main(){ char ch[100]; scanf("%s",ch); int n=strlen(ch); for(int i=0;i<n;i++){ if('a'<=ch[i]&&ch[i]<='...原创 2019-10-29 00:01:29 · 63 阅读 · 0 评论