サマーウォーズ熱が冷めない

4月頃にサマーウォーズのDVD借りとったと言う事実。俺は4ヵ月も損をしてたのかと...
んー、まぁしょうがない。

いろいろと勢いで...
#include <iostream>

int main() {
int date, mon, year;
date = 1;
mon = 1;
year = 2011;

std::cout << mon << ", " << date << ", " << year << " was ";

/*
January -> 13
February -> 14
*/
switch (mon) {
case 1:
mon = 13;
year -= 1;
break;
case 2:
mon = 14;
year -= 1;
break;
}

/*
1994 -> 19 & 94 (mod 100)
*/
int year1, year2;

year2 = year % 100;

year1 = (year - year2) / 100;

/* main */
int s1;
s1 = ((mon + 1) * 26) / 10;

int day;
day = (date + s1 + year2 + (year2 / 4) + (year1 / 4) - (year1 * 2)) % 7;

switch (day) {
case 0:
std::cout << "Saturday." << std::endl;
break;
case 1:
std::cout << "Sunday." << std::endl;
break;
case 2:
std::cout << "Monday." << std::endl;
break;
case 3:
std::cout << "Tuesday." << std::endl;
break;
case 4:
std::cout << "Wednesday." << std::endl;
break;
case 5:
std::cout << "Thursday." << std::endl;
break;
case 6:
std::cout << "Friday." << std::endl;
break;
}

return 0;
}

ってハイライター使っとるつもりなのに何もならんがな;;;

追記@22:42
ハイライト修正。

追記@22:47
あれ、おかしい 何かおかしい...

追記@22:59
ミスがあった恥ずかしい...修正。

0 コメント: