第一题

题目:

代码:

#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. sqlmap中##和$$的区别

    一. 主要区别 #a# //解析sqlmap配置文件时自动加单引号,即'a' $a$ //解析sqlmap配置文件时不加单引号,即a 如果传进来的条件需要order by的话,那一定用第二种 #是把传 ...

  2. CSS选择器详解(二)通用选择器和高级选择器

    目录 通用选择器 高级选择器 子选择器 相邻兄弟选择器 属性选择器 通用选择器 通用选择器可以选择页面上的所有元素,并对它们应用样式,用 * 来表示. 语法: * { property1: value ...

  3. [转]Web后台模拟前端post(带NTLM验证)

    本文转自:http://www.cnblogs.com/pzstudyhard/p/4805885.html using System.Data; using System.Net; using Sy ...

  4. wpf 窗口最小化后,触发某事件弹出最小化窗口并置顶

    //如果窗口最小化了弹出并置顶----事件触发调用 ShowWindowAsync(new System.Windows.Interop.WindowInteropHelper(CommonHelpe ...

  5. Spring扩展:Spring框架的由来

    一.Spring框架的由来

  6. springboot+mybatis遇到BUG:自动注入失败

    今天用springboot+mybatis写一个小demo遇到如下错误 Error starting ApplicationContext. To display the conditions rep ...

  7. Java开发相关官方存档下载地址

    前言 集中收藏Java开发中需要用到的常用下载地址 jdk Java SE 最新下载 | Oracle 技术网 : http://www.oracle.com/technetwork/cn/java/ ...

  8. C#画个控件,指定字符特殊颜色显示

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  9. python中参数传递的方法

    Python中函数传递参数的形式主要有以下五种,分别为位置传递,关键字传递,默认值传递,不定参数传递(包裹传递)和解包裹传递. 1.位置传递实例: def fun(a,b,c) return a+b+ ...

  10. 如何实现监听 console.log

    var lastLog; console.oldLog = console.log; console.log = function(str) { console.oldLog(str); lastLo ...