第一题

题目:

代码:

#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. Windows7 x64 了解堆

    一.前言 堆对于开发者一般来说是熟悉又陌生的,熟悉是因为我们常常使用new/delete或者malloc/free使用堆,陌生是因为我们基本没有去了解堆的结构.堆在什么地方?怎么申请?怎么释放?系统又 ...

  2. <机器学习实战>读书笔记--决策树

    1.决策树的构造 createBranch伪代码: 检测数据集中的每个子项是否属于同一分类: IF SO RETURN 类标签 ELSE 寻找划分数据集的最好特征 划分数据集 创建分支节点 FOR 每 ...

  3. Scrum 冲刺博客第五篇

    一.当天站立式会议照片一张 二.每个人的工作 (有work item 的ID),并将其记录在码云项目管理中 昨天已完成的工作 实现题目的生成并将其显示到页面上,设置了背景音乐 今天计划完成的工作 判断 ...

  4. Eclipse常用快捷键之技巧篇

    如何让你阅读代码如虎添翼?使用快捷键可以让你快到飞起来~ 显示类的方法和属性:ctrl+o ctrl+o能够看到你的类的层次结构,使你搜索该类某个方法更加的方便 显示类的继承:ctrl+T ctrl+ ...

  5. 配置JDK1.7开发环境

    学习java知识,首先要安装jdk来配置开发环境和java运行环境,本文介绍一下JDK配置流程和验证配置成功的方法. 一.配置JDK 1.首先下载jdk1.7压缩包并解压到D盘. 2.我的电脑--右键 ...

  6. java的内存区域

    java的内存区域分为程序计数器.java虚拟机栈.本地方法栈.java堆.方法区.运行时常量池. 1.程序计数器 2.java虚拟机栈 3.本地方法栈 4.java堆(新生代和老年代) 5.方法区( ...

  7. Java8实战Lambda和Stram API学习

    public  class Trader{        private String name;    private String city; public Trader(String n, St ...

  8. 基于netcore对ElasitSearch客户端NEST查询功能的简单封装NEST.Repository

    NEST.Repository A simple encapsulation with NEST client for search data form elasticsearch. github A ...

  9. String 简单使用

    package com.direct.str; public class TestObject { /** * @param args */ /* * 1.object类是根类,里面定义的==和equ ...

  10. js-99乘法表的练习

    <html> <head> <title>World</title> <style type="text/css"> & ...