第一题

题目:

代码:

#include<iostream>
#include<cstdio>
using namespace std; class Date
{
public:
int year;
int month;
int day;
int calculation(int judge,int month,int day);
}; int Date::calculation(int judge,int month,int day)
{
int result=0;
result=(month-1)*31+day;
if(month>2)
{
if(judge==1) //如果是闰年
{
result=result-(month/2)-2;
}
else
{
result=result-(month/2)-1;
}
}
return result;
} int main()
{
Date date1;
int year1,month1,day1,decide,number;
while(scanf("%d %d %d",&year1,&month1,&day1)!=EOF)
{
decide=0;
if(year1==0 && month1==0 && day1==0)
{
break;
}
else
{
if(year1%4==0&&year1%100!=0||year1%400==0)
{
decide=1;
}
number=date1.calculation(decide,month1,day1);
cout<<number<<endl;
}
}
return 0;
}

第二题

题目:

代码

#include<iostream>
#include<cstring>
#include <string>
#include<cstdio>
#include<algorithm>
using namespace std; class Students
{
private: int room;
string name;
int height;
int weight; public:
void begin()
{
height = 0;
}
void getin(string a,int b,int c,int d)
{
if(b>height)
{
room=d;
name=a;
height=b;
weight=c;
}
}
void print()
{
printf("%06d ",room);
cout<<name<<" "<<height<<" "<<weight<<endl;
}
int ad()
{
if(height!=0)
return 0;
else
return 1;
} }student[1000000]; int a[1000000]; int main()
{
int n,i,j=0;
cin>>n;
for(i=0;i<n;i++)
{
int room,height,weight;
string name;
cin>>room>>name>>height>>weight;
a[j]=room;
j=j+student[room].ad();
student[room].getin(name,height,weight,room);
}
sort(a,a+j);
for(i=0;i<j;i++)
{
student[a[i]].print();
}
return 0;
}

第三题

题目:



代码

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std; int num[100000][1000]; int main()
{
int begin,end,i,n,m,x,y,how=0,how1=0,result=0;
cin>>begin>>end;
for(n=begin;n<=end;n++)
{
how=0;
m=sqrt(n);
for(i=1;i<=m;i++)
{
x=n%i;
if(x==0)
{
y=n/i;
num[n][how]=i;
how++;
if(i!=y)
{
num[n][how]=y;
how++;
}
}
}
if(how>how1)
{
how1=how;
result=n;
}
}
sort(num[result],num[result]+how1);
cout<<"["<<begin<<","<<end<<"] ";
cout<<result<<" "<<how1<<endl;
for(i=0;i<how1-1;i++)
{
cout<<num[result][i]<<" ";
}
cout<<num[result][i];
return 0;
}

第四题

题目:



代码

#include<iostream>
#include<cstdio>
#include<stdlib.h>
using namespace std; struct Node
{
int data;
struct Node *next;
}; int main()
{
Node *change(Node *head);
int repeat;
cin>>repeat;
for(int i=0;i<repeat;i++)
{
int n;
Node *head,*p1,*p2;
head=NULL; p2=(Node*)malloc(sizeof(Node)); while(scanf("%d",&n)!=EOF)
{
p1=(Node*)malloc(sizeof(Node));
if(n==-1)
{
p2->next=NULL;
break;
}
else
{
p1->data=n;
if(head == NULL) /*如果是开头的话*/
{
head=p1;
}
else
{
p2->next=p1;
}
p2=p1;
}
}
/*到这里没问题*/
head=change(head); /*删去奇数的节点*/ if(head != NULL) /*输出*/
{
while(head->next != NULL)
{
cout<<head->data<<" ";
head=head->next;
}
cout<<head->data<<endl;
}
}
return 0;
} Node *change(Node *head)
{
Node *p1,*p2;
while(head!=NULL && head->data%2 != 0)
{
head=head->next;
}
p1=p2=head; if(head==NULL)
return head; p1=p1->next;
while(p1 != NULL)
{
if(p1->data%2 != 0)
{
while(p1!=NULL && p1->data%2 != 0)
{
p1=p1->next;
}
p2->next=p1;
}
else
{
p2=p1;
p1=p1->next;
}
}
return head;
}

第五题(与第四题相同,就不贴代码了)

题目:

这一系列下来的收获:

fzu_oop_east 第一次作业的更多相关文章

  1. C 语言学习 第一次作业总结

    第一次的作业是冯老师布置的练习题,需要在pta平台上完成.我这边看不到结果,但是透过冯老师给出的截图,同学们都还是认真的去做的.同时,我这边也布置了一个持续 3 周的作业:熟悉 git 的使用.因为后 ...

  2. 耿丹CS16-2班第一次作业汇总

    第一次作业统计完成. 注:1.作业顺序:取最早交作业的前3名,依次拿5,2,1分,前提是作业质量较高,否则轮至下一名同学得分,其余同学得0分:2.作业情况:满10分,空一题扣2分,心得写得好的有额外加 ...

  3. 软件工程(QLGY2015)第一次作业小结(含成绩)

    相关博文目录: 第一次作业点评 第二次作业点评 第三次作业点评 Github项目提交 github的代码提交,大部分人都只是提交了单个文件,存在几个问题 请提交完整的项目文件到github 问题:为什 ...

  4. 2015级软工实践k班第一次作业-准备

    第一次作业-准备······ 几篇文章阅读下来发现一个事实,还是要有明确的目标,清楚自己需要做什么最为重要.然后根据目标确定需要为之所做的准备工作,考研也好,工作也罢,都是服务于自己的目标. 问题答应 ...

  5. java第一次作业0

    lsl321 java第一次作业 #1. 本章学习总结 你对于本章知识的学习总结 本章我们学习了各种java相关文件的使用,以及码云,博客,pat等程序辅助软件,这些对于我们专业的学习有非常大的帮助, ...

  6. 集大1513 & 1514班 软件工程第一次作业评分与点评

    谢谢大多数同学按时完成了作业,同学态度都比较端正,没有为了完成作业或者讨好老师而说一些假话空话. 很多同学选择CS之前并没有从兴趣或者擅长出发.这是一个普遍的现象,十年前我们是这样,十年后的孩子们还是 ...

  7. OO第一次作业总结

    OO第一次学习总结 1.第一次作业:多项式加法 从未接触过java的我,在从输入输出开始学了几天后,按照C语言的思路,写出了一个与面向过程极其接近的程序. 在这个程序中,存在两个类:一个是Comput ...

  8. # C语言程序设计第一次作业1234

    ---恢复内容开始--- C语言程序设计第一次作业 1.求圆面积和周长 输入圆的半径,计算圆的周长和面积 (1)流程图 (2)测试数据及运行结果 测试数据r=3 运行结果 2.判断闰年 输入一个四位年 ...

  9. 构建之法助教园地第一次作业--点评<西北师范大学|李晓婷>

    一 博客点评 第一次作业--准备篇:https://www.cnblogs.com/Mookiepiece/p/10464606.html#4192515 点评内容: 首先,你对电脑很感兴趣,兴趣就是 ...

随机推荐

  1. 数据库sqlite3在linux中的使用

    在linux下我们首先要获取root权限 当然也可是使用 sudo命令 接着让我们来安装sqlite3吧!博主当然是已经安装好了! 别急,的确你是安装好了sqlite3但是有一点必须要记住,你还没有安 ...

  2. tomcat主页打不开,tomcat manager 配置,Failed to start component [StandardEngine[Catalina].

    Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Serv]] ...

  3. del

    Before writing it I spent a fair amount of time on reviewing our chat-log. How silly. asljdfajsodfss ...

  4. 使用Docker镜像部署ELK日志系统

    使用Docker部署elasticsearch.logstash.kibana 指定版本:6.7.1 (建议使用同一的版本.屏蔽三个软件间的不兼容性) 下载镜像: docker pull elasti ...

  5. 最新的dubbo和zookeeper整合的问题

    最新的dubbo和zookeeper整合的问题 生活本不易,流人遂自安 博主最新在做小项目练手,在进行dubbo和zookeeper整合的时候遇到了一些问题,在这里这些问题做个小总结吧. 首先需要说明 ...

  6. 分布式微服务技术之 Spring Cloud Netflix

    1 背景 Netflix 是全球十大视频网站中唯一收费站点,是美国互联网流媒体播放商,由于访问量巨大,转型为云计算公司. 由Netflix公司主持开发了一套代码框架和库Netflix OSS即open ...

  7. varchar(n)跟varchar(max)的区别

    本文来源于翁舒航的博客,点击即可跳转原文观看!!!(被转载或者拷贝走的内容可能缺失图片.视频等原文的内容) 若网站将链接屏蔽,可直接拷贝原文链接到地址栏跳转观看,原文链接:https://www.cn ...

  8. 搭建和启动javaWeb项目

    首先,我们得配置服务器,我的demo采用tomcat 你只要找到tomcat的home路径就好了,后面会自动给你提示的

  9. [LeetCode]Maximum Subarray题解

    Maximum Subarray: Find the contiguous subarray within an array (containing at least one number) whic ...

  10. oauth2.0授权协议

    参考文章 一.OAuth是什么? OAuth的英文全称是Open Authorization,它是一种开放授权协议.OAuth目前共有2个版本,2007年12月的1.0版(之后有一个修正版1.0a)和 ...