結果

問題 No.3402 [Cherry Anniversary 5] Beyond Zelkova, the 5th year vista seen through the bloom of a cherry bloosom
コンテスト
ユーザー Mike scarf
提出日時 2025-12-12 15:45:17
言語 C++23
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 1,070 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,733 ms
コンパイル使用メモリ 275,464 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-12 15:45:24
合計ジャッジ時間 6,172 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   26 |     scanf("%lld%lld%lld",&ye,&me,&de);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:31:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |     scanf("%lld",&q);
      |     ~~~~~^~~~~~~~~~~
main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |         scanf("%lld%lld%lld",&y,&m,&d);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf=1e18;
const int maxn=200005;
ll ys,ms,ds,ye,me,de,q,y,m,d;
ll md[15]={0,31,28,31,30,31,30,31,31,30,31,30,31};
bool leap(ll y){
    return (y%4==0 and y%100!=0) or (y%400==0);
}
ll get_days(ll y,ll m,ll d){
    ll i,res=0;
    for(i=1;i<y;i++){
        res+=365+leap(i);
    }
    for(i=1;i<m;i++){
        if(i==2) res+=28+leap(y);
        else res+=md[i];
    }
    res+=d;
    return res;
}
int main(){
    ll b_days,a_days,start_val,end_val,next_start_val,curr_val;
    if(scanf("%lld%lld%lld",&ys,&ms,&ds)!=3) return 0;
    scanf("%lld%lld%lld",&ye,&me,&de);
    start_val=get_days(ys,ms,ds);
    end_val=get_days(ye,me,de);
    b_days=end_val-start_val+1;
    next_start_val=end_val+1;
    scanf("%lld",&q);
    while(q--){
        scanf("%lld%lld%lld",&y,&m,&d);
        curr_val=get_days(y,m,d);
        a_days=curr_val-next_start_val+1;
        if(a_days<b_days) printf("Less\n");
        else if(a_days==b_days) printf("Same\n");
        else printf("More\n");
    }
    return 0;
}
0