Add tags

Add tags to the following comment
正弦関数の周期性を利用しました。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import std.stdio;
import std.math;

bool isLeapYear(int year){
    return abs(sin(year * PI * 0.25)) < 0.0001 &&
           abs(sin(year * PI * 0.01)) > 0.0001 ||
           abs(sin(year * PI * 0.0025)) < 0.0001;
}

void main(){
    writefln(isLeapYear(1900));  // false
    writefln(isLeapYear(1978));  // false
    writefln(isLeapYear(1988));  // true
    writefln(isLeapYear(2000));  // true
    writefln(isLeapYear(2001));  // false
    writefln(isLeapYear(2008));  // true
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...