Add tags

Add tags to the following comment
正規表現で。
sub judge()はうるう年のとき1、通常年のときは0を返します。

実行結果:
$ ./dk124.pl
1900 0
2000 1
2008 1
2100 0
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/usr/bin/perl

sub judge($)
{
    $_ = shift;
    return 0 != (/(([13579][26])|([02468][048]))00$/ || (!/00$/ && /(([13579][26])|([02468][048]))$/));
}

for (1900, 2000, 2008, 2100) {
    printf("%d %d\n", $_, judge($_));
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...