陽曆曆法
臺灣目前使用的曆法為陰陽合曆。其中陽曆的部分,年的制訂是利用太陽的運動而來,1回歸年(或太陽年)實際長度為365.24219天,陽曆曆法上的1年長度為365天,每年會因而多出0.24219天(相當於5.8小時),如此一來,累積4年後為0.96876天,幾近1天,為修正之,故國曆曆法中有「閏年」制度,每4年會多2月29日這一天。
然而,累積4年後多的0.96876天,與真正的1日尚差0.03124天,故如果不間斷地按4年1閏的方式修正,百年後將累積成365×100+25=36525日,比真正的1世紀日數365.24219×100=36524.219多。
因此曆法學家便重新規定閏年的規則為:西元年份逢4的倍數閏、100的倍數不閏、400的倍數閏、4000的倍數不閏。例如:西元1992、1996年等為4的倍數,故為閏年;西元1700、1800、1900年為100的倍數,當年不閏年;西元1600、2000、2400年為400的倍數,有閏;而西元4000、8000年為4000的倍數,則不閏。
出處:http://tamweb.tam.gov.tw/news/2010/201002/news2010020904.htm
herrDeng網內搜尋
自訂搜尋
Ads
2012年3月7日 星期三
閏年的判斷程式
請照下列台北天文台陽年閏年說明,寫一判斷輸入公元n年(n>0)是否為閏年的判斷程式。
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
你會用C的算子sizeof?
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
-
C++ DP動態規劃解Leetcode 937 Maximum Number of Points with Cost 有些標示medium要比標示hard的問題還要難,Leetcode 1937. Maximum Number of Points with Cost,DP動態規...
37 則留言:
import java.util.*;
public class n {
public static void main(String[] args)
throws Exception
{
Scanner sc = new Scanner(System.in);
System.out.println("請輸入年份=> ");
int n = sc.nextInt();
if(n%4000==0)
System.out.println("平年");
else if (n%400==0)
System.out.println("閏年");
else if (n%100==0)
System.out.println("平年");
else if (n%4==0)
System.out.println("閏年");
else System.out.println("平年");
}
}
import java.util.*;
public class useScanner {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else
System.out.println("平年");
}
}
import java.util.*;
public class useScanner{
public static void main(String[]args)
{
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class useScanner{
public static void main (String [] args){
int n;
Scanner SC=new Scanner (System.in);
n=SC.nextInt();
if(n%4000==0){
System.out.println("平");
}
else if (n%400==0){
System.out.println("閏");
}
else if (n%100==0){
System.out.println("平");
}
else if (n%4==0){
System.out.println("閏");
}
else {
System.out.println("平");
}
}
}
import java.util.*;
public class useScanner {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class useScanner{
public static void main(String[]args)
{
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class useScanner{
public static void main(String[]args)
{
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class useScanner{
public static void main(String[]args)
{
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class useScanner{
public static void main(String[]args)
{
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class hello {
public static void main(String [] args) throws Exception {
Scanner sc=new Scanner(System.in);
System.out.println("請輸入年份=");
int n=sc.nextInt();
if(n%4000==0){
System.out.println("平");
}
else if(n%400==0){
System.out.println("閏");
}
else if(n%100==0){
System.out.println("平");
}
else if(n%4==0){
System.out.println("閏");
}
else{
System.out.println("平");
}
}
}
import java.util.*;
public class hello {
public static void main(String [] args)throws Exception {
Scanner sc=new Scanner (System.in);
System.out.println(請輸入年份=");
if(n%4000==0){
System.out.println("平");
}
else if(n%400==0)}{
System.out.println("閏");
}
else if(n%100==0){
System.out.println("平");
}
else if(n%4==0){
System.out.println("閏");
}
else{
System.out.println("平");
}
}
}
import java.util.*;
public class useScanner1 {
public static void main (String [] args) {
Scanner sc=new Scanner (System.in);
System.out.print("請輸入年份=>");
int year = sc.nextInt();
if(year%4000==0){
System.out.println("平年");
}
else if (year%400==0){
System.out.println("閏年");
}
else if (year%100==0){
System.out.println("平年");
}
else if (year%4==0){
System.out.println("閏年");
}
else System.out.println("平年");
}
}
import java.util.*;
public class useScanner{
public static void main(String[]args)
{
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class good {
public static void main(string[] args) {
Scanner sc = new java.util.Scanner(System.in);
int i = sc.nextInt();
if( i%4000==0)
System.out.println("平年");
else if (i%400==0)
System.out.println("閏年");
else if (i%100==0)
System.out.println("平年");
else if (1%4==0)
System.out.println("閏年");
else
System.out.println("平年");
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
⋯⋯ new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class Test {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("請輸入西元元年份:");
while( sc.hasNext() ){
int a = sc.nextInt();
if( (a % 4 == 0 && a % 100 != 0) || a % 400 == 0 )
System.out.println("閏年");
else
System.out.println("平年");
System.out.println("請輸入西元元年份:");
}
}
}
import java.util.*;
public class yy {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份:");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class yy {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class test {
public static void main(String[] args) {
java.util.Scanner sc =
newjava.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class test {
public static void main (String [] args) {
java.util.Scanner sc=
new java.util.Scanner(System.in);
System.out.print("請輸入年份");
int n=sc.nextInt();
if (n%4000==0) {
System.out.println("平年");
}
else if (n%400==0) {
System.out.println("閏年");
}
else if (n%100==0) {
System.out.println("平年");
}
else if (n%4==0) {
System.out.println("閏年");
}
else {
System.out.println("平年");
}
}
}
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int n = sc.nextInt();
if( n%4000==0) {
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class hello{
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class Hello{
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class yy {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.Scanner;
public class year{
public static void main(String[] args){
int year = 0;
Scanner scanner = new Scanner(System.in);
System.out.printf("請輸入西洋年:");
year= scanner.nextInt();
if(year % 4 == 0){
if(year % 100 ==0){
if( year % 400 ==0){
if( year % 4000 ==0)
System.out.printf("%d 是平年哦",year);
else
System.out.printf("%d 是閏年耶...",year);
}
else
System.out.printf("%d 是平年哦",year);
}
else
System.out.printf("%d 是閏年耶...",year);
}
else
System.out.printf("%d 是平年哦",year);
}
}
import java.util.*;
public class n {
public static void main(String[] args)
throws Exception
{
Scanner sc = new Scanner(System.in);
System.out.println("請輸入年份=> ");
int n = sc.nextInt();
if(n%4000==0)
System.out.println("平年");
else if (n%400==0)
System.out.println("閏年");
else if (n%100==0)
System.out.println("平年");
else if (n%4==0)
System.out.println("閏年");
else System.out.println("平年");
}
}
import java.util.*;
public class hello {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class test {
public static void main(String[] args) {
java.util.Scanner sc =
new java.util.Scanner(System.in);
System.out.print("請輸入西年年份");
int i = sc.nextInt();
if( i%4000==0) {
System.out.println("平年");
}
else if (i%400==0){
System.out.println("閏年");
}
else if (i%100==0){
System.out.println("平年");
}
else if (i%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class useScanner{
public static void main(String[]args)
{
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class useScanner{
public static void main(String[]args)
{
int n;
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
import java.util.*;
public class tred {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
if(n%4000==0){
System.out.println("平年");
}
else if (n%400==0){
System.out.println("閏年");
}
else if (n%100==0){
System.out.println("平年");
}
else if (n%4==0){
System.out.println("閏年");
}
else{
System.out.println("平年");
}
}
}
張貼留言