有关日历计算,要求输入n,输出从2000.1.1开始往后n天的那一天的年月日星期.Given the number of days that have elapsed since January 1,2000 A.D,your mission is to find the date and the day of the week.InputThe input consists of l

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/04 08:24:29

有关日历计算,要求输入n,输出从2000.1.1开始往后n天的那一天的年月日星期.Given the number of days that have elapsed since January 1,2000 A.D,your mission is to find the date and the day of the week.InputThe input consists of l
有关日历计算,
要求输入n,输出从2000.1.1开始往后n天的那一天的年月日星期.
Given the number of days that have elapsed since January 1,2000 A.D,your mission is to find the date and the day of the week.
Input
The input consists of lines each containing a positive integer,which is the number of days that have elapsed since January 1,2000 A.D.The last line contains an integer -1,which should not be processed.You may assume that the resulting date won't be after the year 9999.
Output
For each test case,output one line containing the date and the day of the week in the format of "YYYY-MM-DD DayOfWeek",where "DayOfWeek" must be one of "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday" and "Saturday".
Sample Input
1730
1740
1750
1751
-1
Sample Output
2004-09-26 Sunday
2004-10-06 Wednesday
2004-10-16 Saturday
2004-10-17 Sunday
要c的

有关日历计算,要求输入n,输出从2000.1.1开始往后n天的那一天的年月日星期.Given the number of days that have elapsed since January 1,2000 A.D,your mission is to find the date and the day of the week.InputThe input consists of l
以下是用C++写的
#include
struct InNum
{
int num;
InNum *next;
};
void main()
{
int year=2000,day=1,mouth=1,dayTemp=0,week0=6,week;
InNum *head,*last,*p;
head=new InNum;
head->next=NULL;
last=head;
p=new InNum;
cin>>p->num;
p->next=NULL;
last->next=p;
last=last->next;
while(p->num>0)
{
p=new InNum;
cin>>p->num;
p->next=NULL;
last->next=p;
last=last->next;
}
p=head->next;
while(p->num>=0)
{
p->num--;
while(p->num>=365)
{
year++;
p->num-=365;
}
dayTemp=p->num;
while(p!=NULL && p->num>28)
{
if(2==mouth && 0==year%4 && p->num>=29)
{
mouth++;
p->num-=29;
}
else if(2==mouth && p->num>=28)
{
mouth++;
p->num-=28;
}
else if(mouthnum>mouth%2+30)
{
p->num-=(mouth%2+30);
mouth++;
}
else if(mouth>=9 && p->num>(mouth+1)%2+30)
{
p->num-=((mouth+1)%2+30);
mouth++;
}
else
break;
}
day = p->num;
week = (dayTemp + year-2001+1)%7;
cout

有关日历计算,要求输入n,输出从2000.1.1开始往后n天的那一天的年月日星期.Given the number of days that have elapsed since January 1,2000 A.D,your mission is to find the date and the day of the week.InputThe input consists of l c语言 计算m的n次方 要求输入m、n 输出m的n次方 从键盘上输入任意一个整数n,计算1到n的和.输入 从键盘输入任意整数n.输出1到n的和.用c语言从键盘上输入任意一个整数n,计算1到n的和.输入从键盘输入任意整数n.输出输出1到n的和.用c语言( C语言编程:输入任意一个年份和月份,按格式输出该月份的公历日历编程序实现如下功能:输入任意一个年份和月份,按以下格式输出该月份的公历日历.要求由程序计算出来该月份的1日是星 求阶乘问题.要求定义函数fact(n)计算n!,主函数中输入一个正整数n,输出n!要求函数fact(n)分别采用递归…求阶乘问题.要求定义函数fact(n)计算n!,主函数中输入一个正整数n,输出n!,要求函数fact(n)分 VB编写程序 用来计算m的n次方其中m,n由用户输入 输出在窗体上 要求将计算m的n次方写成函数 输入一个正整数n,计算1+1/2!+1/3!……1/n!的和并输出.要求将计算阶乘的运算定义用C语言! 【问题描述】从键盘输入一个正整数n,计算n!的值.要求定义和调用函数fact(n),函数类型为double型.【输入形式】输入一个正整数n【输入输出样例】Input n:1010!=3628800.00【样例说明】输出数据为双 计算s =1+12+123+1234+12345+...要求用函数计算每一项,在主函数中输入累加项数n,计算结果并输出. 计算下列级数和的近似值,x的值从键盘输入,求和精度为10-6,输出达到精度要求的最小n与级数和s(x)=x-x3/3!+x5/5!-x7/7!+……+(-1)n-1·x2n-1/(2n-1)!【输入形式】从键盘输入x的值(实数).【输出形式】【样 c语言 编写程序,从键盘输入一个整数,计算并输出它是几位数.若输入的是负数时,要求重新输入. 输入一个正整数n,生成一张阶乘表,输出 的值,要求定义和调用函数fact(n)计算 ,函数类型为dou 编写程序验证:任何一个自然数n立方都等于n个连续奇数之和.要求对每个输入的自然数计算并输出相应连续奇数 设计一个窗体,要求输入一个正整数N,计算并输出N的阶乘.VB的要写出这个题目的代码! 编写一个C#控制台应用程序,对于输入的正整数n,计算1!+2!+3!+…+n!的值并输出结果!要求完整的哈! 对运行中输入的x,计算级数:1+ x – x2/2!+ x3/3!- …(-1) n+1*xn/n!.要求输出精度为10-8. 根据组合公式可以计算出从n个不同元素取出m 个元素的组合数,用C语言编写程序,输入2个正整数m和n,计算并输出组合数,要求定义和调用函数fact(n)计算n!,函数类型是double 编程计算1~n之间所有素数的和,其中n的值从键盘输入,且n>50,要求编写两个函数,一个函数判断某个数是否为素数,另一个函数实现累加求和,在主函数中输入n,并输出计算结果.自己编的感觉太乱