只做了前三个题,在本地调试好了,不知为什么错了,好歹做了那么久,就记录一下了(注:这不是标准答案,只是我给出的解答)

这是第一题的代码:

#include<stdio.h>
#include<malloc.h>
#include<stdlib.h>
typedef struct ar{
int a[];
struct ar *next;
}arNode; void insert(arNode *p,int x,int i,int j,int n,int m)
{
int i2,j2,i3,j3;
i2=m-(j+);
j2=i; for(i3=;i3<=i2;++i3)
{
p=p->next;
p->a[j2]=x;
} } void showResult(arNode *p,int n,int m)
{
int i,j;
for(i=;i<m;++i)
{
p=p->next;
for(j=;j<n;++j)
{
printf("%d ",p->a[j]);
}
printf("\n");
}
} int main()
{
arNode *L,*p;
int m,n,i,j,x; L=(arNode *)malloc(sizeof(arNode));
L->next=NULL;
p=L;
for(i=;i<;++i)
{
p->next=(arNode *)malloc(sizeof(arNode));
p->next->next=NULL;
p=p->next;
}
scanf("%d %d",&n,&m);
fflush(stdin);
for(i=;i<n;++i)
{
for(j=;j<m;++j)
{
scanf("%d",&x);
insert(L,x,i,j,n,m);
}
} showResult(L,n,m);
return ;
}

这是第二题的代码:

#include<stdio.h>
struct ar{
int n;
int t;
}a[];
int nn=;
void insert(int x)
{
int i;
for(i=;i<nn;++i)
{
if(a[i].n==x)
break;
}
if(i<nn)
{
++a[i].t;
}
else{
a[nn].n=x;
a[nn].t=;
++nn;
}
} void output()
{
int i;
for(i=;i<nn;++i)
{
printf("%d %d\n",a[i].n,a[i].t);
}
} void pai()
{
int i,j,k,tmp,index;
struct ar ttt;
for(i=;i<nn;++i)
{
for(j=i;j<nn;++j)
{
if(a[i].n>a[j].n)
{
ttt=a[i];
a[i]=a[j];
a[j]=ttt;
}
}
}
for(i=;i<nn;++i)
{
index=i;
for(j=i;j<nn;++j)
{
if(a[index].t<a[j].t)
{
index=j;
}
}
ttt=a[index];
for(k=index;k>i;--k)
{
a[k]=a[k-];
}
a[i]=ttt;
}
} int main()
{ int n,i,x;
scanf("%d",&n);
fflush(stdin);
for(i=;i<n;++i)
{
scanf("%d",&x);
insert(x);
}
pai(); output();
return ;
}

这是第三题的代码:

#include<stdio.h>
int a[]={,,,,,,,,,,,,};
int daysYear(int year)//返回某年有多少天
{
if(!(year%))
return ;
else{
if(!(year%) && (year%))
{
return ;
}else{
return ;
}
}
} int week(int year,int month)//返回某年某月1日是星期几
{
int i,sum=,result;
for(i=;i<year;++i)
{
sum+=daysYear(i);
}
for(i=;i<month;++i)
{
if((daysYear(year)==) && i==)
{
sum+=;
}
else{
sum+=a[i];
}
}
result=(sum+)%;
return result==?:result;
} int jihao(int year,int month,int b,int c)
{
int yihao,count,d;
yihao=week(year,month);//1号是星期几
d=(daysYear(year)== && month==)?:a[month];//本月天数
if(c>=yihao)
{
count=(b-)*+(c-yihao)+;
}else{
count=b*-(yihao-c)+;
}
if(count>d)
{
count=;
}
return count;
}
int main()
{
int a1,b1,c1,year1,year2,i;
scanf("%d %d %d %d %d",&a1,&b1,&c1,&year1,&year2);
for(i=year1;i<=year2;++i)
{
if(jihao(i,a1,b1,c1)==)
{printf("none\n");}
else{
printf("%d/%.2d/%.2d\n",i,a1,jihao(i,a1,b1,c1));
}
}
//printf("%d",jihao(2015,5,2,7));
return ;
}

就做出这三个题。。。。。。

我的2015年ccf的解答的更多相关文章

  1. 【深度学习Deep Learning】资料大全

    最近在学深度学习相关的东西,在网上搜集到了一些不错的资料,现在汇总一下: Free Online Books  by Yoshua Bengio, Ian Goodfellow and Aaron C ...

  2. 机器学习(Machine Learning)&深度学习(Deep Learning)资料(Chapter 2)

    ##机器学习(Machine Learning)&深度学习(Deep Learning)资料(Chapter 2)---#####注:机器学习资料[篇目一](https://github.co ...

  3. 中国计算机学会CCF推荐国际学术会议和期刊目录(PDF版,2015年)

    total: CCF推荐国际学术会议和期刊目录(下载) parts: 点击下载:  计算机体系结构并行与分布计算存储系统.pdf 点击下载:  计算机网络.pdf 点击下载:  网络与信息安全.pdf ...

  4. ccf题库中2015年12月2号消除类游戏

    题目如下: 问题描述 消除类游戏是深受大众欢迎的一种游戏,游戏在一个包含有n行m列的游戏棋盘上进行,棋盘的每一行每一列的方格上放着一个有颜色的棋子,当一行或一列上有连续三个或更多的相同颜色的棋子时,这 ...

  5. CCF计算机职业资格认证 2015年3月第2题 数字排序 解法和思路

    问题描写叙述 给定n个整数,请统计出每一个整数出现的次数.按出现次数从多到少的顺序输出. 输入格式 输入的第一行包括一个整数n,表示给定数字的个数. 第二行包括n个整数.相邻的整数之间用一个空格分隔, ...

  6. 2015元旦来个炫的html5特效

    效果网址:http://keleyi.com/keleyi/phtml/html5/5.htm 代码: <!DOCTYPE html> <html xmlns="http: ...

  7. 发布有礼!2015 Autodesk程序商店有奖发布活动拉开序幕

    您是不是有希望您的 Autodesk 产品应用程序有更多的用户?您是不是正在寻求更广阔的市场机会?您是不是在激荡人心的云时代大潮中有许多奇思妙想没有小试身手? 来吧,来参加Autodesk应用程序发布 ...

  8. Visual Studio 2015 工具箱丢失

    网上主要的解答分为两种:1. 未打开设计界面 2. 重置 实际上,还有一个原因是,没有启动完整版的VS. 安装完后,会有两个VS的程序,一个是Blend For Visual Studio 2015, ...

  9. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 G. Garden Gathering

    Problem G. Garden Gathering Input file: standard input Output file: standard output Time limit: 3 se ...

随机推荐

  1. aws.s3的 upload 和putObject有什么区别

    相同点:上传或新增一个object : <template> <div class="page"> <!-- 参考:https://blog.csdn ...

  2. ELK系列二:Elasticsearch的架构原理和配置优化

    1.Elasticsearch的数据组织架构 1.1.Elasticsearch结构概念 集群(cluster):拥有相同cluster-name的elasticsearch结点的集合(每个结点其实就 ...

  3. mysql里查看时间

    MariaDB [jumpserver]> select current_time;+--------------+| current_time |+--------------+| 16:22 ...

  4. os.walk的用法

    import os path = 'C:\\aa' for root,dirs,files in os.walk(path): print("Root=",root,'dirs=' ...

  5. [Log]ASP.NET之HttpModule拦截404异常

    Httpmodule代码: public class Error404Module : IHttpModule { public void Init(HttpApplication context) ...

  6. Unity3D 面试三 ABCDE

    说说AB两次面试: “金三银四” 三月份末又面试过两家:共和新路2989弄1号1001这家找了我半天,哇好漂亮的办公大楼!问了保安才知道,这个地址是小区地址.另一家也是创业公司面试我的自称是在腾讯做过 ...

  7. python 读取一个目录下的所有目录和文件

    #!/usr/bin/python # -*- coding:utf8 -*- import os allFileNum = 0 def printPath(level, path): global ...

  8. ElasticSearch在linux上安装部署(转)

    一.安装准备工作安装参考文档: ELK官网:https://www.elastic.co/ ELK官网文档:https://www.elastic.co/guide/index.html ELK中文手 ...

  9. ch 与等宽字体

    难题 有的时候,特别想通过字符来判断元素的长度,比如: 多行文本溢出时,文字变省略号 文字一个个的显示 效果分别如下: 第一种情况下,如果可以通过字符的数量判断长度是否溢出,从而把最后几个字符替换成省 ...

  10. Windows下使用Gflags和UMDH查找内存泄漏

    GFlags和UMDH与WinDbg一样,都是Debugging Tools for Windows里的工具. 1.设置符号路径 去微软官网下载对应的操作系统的符号安装文件,并安装到某个目录,如C:\ ...