第一题

题目:

代码:

#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. 大数据sql引擎

    Hive:把sql解析后用MapReduce跑 SparkSQL:把sql解析后用Spark跑,比hive快点 Phoenix:一个绕过了MapReduce运行在HBase上的SQL框架 Drill/ ...

  2. iOS 真机测试错误“The application could not be verified”

    iOS 真机测试错误"The application could not be verified" 真机测试的时候报错:"The application could no ...

  3. Android OpenGL教程-第六课【转】

    第六课 纹理映射: 在这一课里,我将教会你如何把纹理映射到立方体的六个面. 激动的时刻来了,加载图片了. 复习一下android加载图片的知识.放一个png到drawable里面. (图片文件名:ne ...

  4. JavaScript对象——原型与原型链

    原型与原型链 一. 普通对象与函数对象 JavaScript 中,万物皆对象!但对象也是有区别的.分为普通对象和函数对象,Object .Function 是 JS 自带的函数对象.下面举例说明 va ...

  5. i.mx android6 输入子系统分析(未完)

    参考:http://blog.csdn.net/u010312937/article/details/53285286 https://www.jianshu.com/p/7fca94b330ea   ...

  6. 【转】如何用Maven创建web项目(具体步骤)

    使用eclipse插件创建一个web project 首先创建一个Maven的Project如下图 我们勾选上Create a simple project (不使用骨架) 这里的Packing 选择 ...

  7. C#学习笔记(基础知识回顾)之值类型和引用类型

    一:C#把数据类型分为值类型和引用类型 1.1:从概念上来看,其区别是值类型直接存储值,而引用类型存储对值的引用. 1.2:这两种类型在内存的不同地方,值类型存储在堆栈中,而引用类型存储在托管对上.存 ...

  8. DOM基础操作(二)

    插入操作 1.appendChild(child); 这个是父级调用的方法,它会将child元素插入到父级里面,而且是放到逻辑后面的位置上.   div.appendChild(comment);   ...

  9. IEEE VIS 2018专题

    PoPo数据可视化 聚焦于Web数据可视化与可视化交互领域,发现可视化领域有意思的内容.不想错过可视化领域的精彩内容, 就快快关注我们吧 :) 本文带有视频,浏览视频请关注公众号浏览. IEEE VI ...

  10. Struts2详讲

    一 概述 1.什么是Struts2? Struts2是一个在WebWork框架基础上发展起来开源MVC框架. 2.StrutsPrepareAndExecuteFilter StrutsPrepare ...