cjweffort

博客园 首页 联系 订阅 管理
上一页 1 ··· 10 11 12 13 14

2013年3月2日

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=8题目描述:给出年分m和一年中的第n天,算出第n天是几月几号。输入:输入包括两个整数y(1 int isLeap(int year) { return (year%4==0&&year%100!=0||year%400==0)?1:0; } void printDate(int *mDay,int year,int nDays) { int month=1,day; int tag=isLeap(year); if(tag) mDay[2]+=1; while(nDays>m 阅读全文
posted @ 2013-03-02 11:25 cjweffort 阅读(148) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=7题目描述:输入年、月、日,计算该天是本年的第几天。输入:包括三个整数年(1 int Runyear(int yy) { if(yy%4==0&&(yy%100!=0||yy%400==0)) return 1; return 0; } int Count(int yy,int mm,int dd) { int sum=0; if(mm>1) sum+=31; if(mm>2) if(Runyear(yy)) ... 阅读全文
posted @ 2013-03-02 11:22 cjweffort 阅读(152) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=6题目描述:We now use the Gregorian style of dating in Russia. The leap years are years with number divisible by 4 but not divisible by 100, or divisible by 400.For example, years 2004, 2180 and 2400 are leap. Years 2004, 2181 and 2300 are not leap.Your ta 阅读全文
posted @ 2013-03-02 11:22 cjweffort 阅读(168) 评论(0) 推荐(0) 编辑

摘要: // 题目6:日期差值.cpp: 主项目文件。 #include "stdafx.h" #include int mDay[13]={31,28,31,30,31,30,31,31,30,31,30,31}; int mYear[2]={365,366}; int isLeap(int year) { return (year%4==0&&year%100!=0||year%400==0)?1:0; } int days(int yy,int mm,int dd) { int res=0; for(int i=1;i<mm;i++) res+=mDay 阅读全文
posted @ 2013-03-02 11:13 cjweffort 阅读(156) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=3题目描述: Excel可以对一组纪录按任意指定列排序。现请你编写程序实现类似功能。 对每个测试用例,首先输出1行“Case i:”,其中 i 是测试用例的编号(从1开始)。随后在 N 行中输出按要求排序后的结果,即:当 C=1 时,按学号递增排序;当 C=2时,按姓名的非递减字典序排序;当 C=3时,按成绩的非递减排序。当若干学生具有相同姓名或者相同成绩时,则按他们的学号递增排序。输入: 测试输入包含若干测试用例。每个测试用例的第1行包含两个整数 N (N #include #include # 阅读全文
posted @ 2013-03-02 11:12 cjweffort 阅读(205) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=4题目描述:输入一个字符串,长度小于等于200,然后将输出按字符顺序升序排序后的字符串。输入:测试数据有多组,输入字符串。输出:对于每组输入,输出处理后的结果。样例输入:bacd样例输出:abcd// 题目5:字符串内排序.cpp: 主项目文件。 #include "stdafx.h" #include #include #include #include #include #include #include #include #include #include #includ 阅读全文
posted @ 2013-03-02 11:11 cjweffort 阅读(224) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=2题目描述:输入一系列整数,将其中最大的数挑出,并将剩下的数进行排序。输入:输入第一行包括1个整数N,1 #include #include using namespace std; const int N=1003; int a[N]; int main() { int n; while(scanf("%d",&n)!=EOF) { for(int i=0;i<n;i++) scanf("%d",a+i); sort(a,a+n); if(n 阅读全文
posted @ 2013-03-02 11:05 cjweffort 阅读(183) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=1题目描述: 有N个学生的数据,将学生数据按成绩高低排序,如果成绩相同则按姓名字符的字母序排序,如果姓名的字母序也相同则按照学生的年龄排序,并输出N个学生排序后的信息。输入: 测试数据有多组,每组输入第一行有一个整数N(N #include #include using namespace std; const int N=1003; typedef struct STU { char name[101]; int age,score; }STU; STU stu[N]; bool cmp(... 阅读全文
posted @ 2013-03-02 11:03 cjweffort 阅读(315) 评论(0) 推荐(0) 编辑

摘要: http://ac.jobdu.com/problem.php?cid=1040&pid=0题目描述: 对输入的n个数进行排序并输出。输入: 输入的第一行包括一个整数n(1 #include using namespace std; const int N=103; int a[N]; int main() { int n; while(scanf("%d",&n)!=EOF) { for(int i=0;i<n;i++) scanf("%d",a+i); sort(a,a+n); for(int i=0;i<n;i++) { 阅读全文
posted @ 2013-03-02 10:59 cjweffort 阅读(210) 评论(0) 推荐(0) 编辑

上一页 1 ··· 10 11 12 13 14