判断闰年的另类条件

来源:互联网 发布:都市年轻人养猫数据 编辑:程序博客网 时间:2024/04/27 15:50

 #include<iostream>
using namespace std;

int main()
{
// freopen("1.txt", "r", stdin);
 long int i;

 cin >> i;

 while (0 != i)
 {
  bool  bRet = false;
  if ((0 == i % 172800) && (0 == i % 86400))
  {
   bRet = true;
   goto Exit0;
  }

  if (((0 == i % 4) && (0 != i % 100)) || ((0 == i % 400)&&(0 != i % 3200 )))
  {
   bRet = true;
  }

Exit0:
  if (bRet)
  {
   cout << "YES" << endl;
  }
  else
  {
   cout << "NO" << endl;
  }
  
  cin >> i;
 }

 return 0;
}

原创粉丝点击