由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 微软的zune bug
相关主题
question about const reference请教一个关于字符指针的简单问题
[合集] static const代替define的performance tradeoff在哪里?Re: 几个C++的问题
const_cast问题why use static function here?
function declarationC++ class cross reference problem
!!! 号外 Microsoft Zune Bug!!!c++ string 一问
Re: VC里面的stl支持是不是很弱?How to initialize object in constructor?
size不固定的struct怎么定义呀?引用的几个基本问题,有点糊涂
strlen怎么实现的a c++ question
相关话题的讨论汇总
话题: int话题: cycle话题: const话题: cday话题: 365
进入Programming版参与讨论
1 (共1页)
s******n
发帖数: 876
1
面试题, fix it with O(1) algorithm.
有包子啊
t****t
发帖数: 6806
2
这个还需要包子?

【在 s******n 的大作中提到】
: 面试题, fix it with O(1) algorithm.
: 有包子啊

g****n
发帖数: 14
3
抛砖引玉吧 :)
const int DAYS_80_99 = 20 * 365 + 5;
const int CYCLE_400 = 365 * 400 + 97;
const int CYCLE_100_L = 365 * 100 + 25;
const int CYCLE_100_N = 365 * 100 + 24;
const int CYCLE_4_L = 365 * 4 + 1;
const int CYCLE_4_N = 365 * 4;
// input: cDay - number of days since Jan 1, 1980.
// For Jan 1, 1980, cDay==0
// output: year, day (this first day of a year is represented as 0).
void year(int cDay, int& year, int& day)
{
int days = cDay;
int years = 1980;
if (days >= DAYS_80_99)
s******n
发帖数: 876
4
this is too long. let's make Jan 1st 2001 as Day 0.

【在 g****n 的大作中提到】
: 抛砖引玉吧 :)
: const int DAYS_80_99 = 20 * 365 + 5;
: const int CYCLE_400 = 365 * 400 + 97;
: const int CYCLE_100_L = 365 * 100 + 25;
: const int CYCLE_100_N = 365 * 100 + 24;
: const int CYCLE_4_L = 365 * 4 + 1;
: const int CYCLE_4_N = 365 * 4;
: // input: cDay - number of days since Jan 1, 1980.
: // For Jan 1, 1980, cDay==0
: // output: year, day (this first day of a year is represented as 0).

1 (共1页)
进入Programming版参与讨论
相关主题
a c++ question!!! 号外 Microsoft Zune Bug!!!
Question on C++ Access Control (protected)Re: VC里面的stl支持是不是很弱?
Is it safe?size不固定的struct怎么定义呀?
which func will be called?strlen怎么实现的
question about const reference请教一个关于字符指针的简单问题
[合集] static const代替define的performance tradeoff在哪里?Re: 几个C++的问题
const_cast问题why use static function here?
function declarationC++ class cross reference problem
相关话题的讨论汇总
话题: int话题: cycle话题: const话题: cday话题: 365