結果

問題 No.260 世界のなんとか3
ユーザー C7C7LLC7C7LL
提出日時 2018-07-26 13:51:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 769 bytes
コンパイル時間 1,148 ms
コンパイル使用メモリ 145,428 KB
実行使用メモリ 11,780 KB
最終ジャッジ日時 2023-09-13 18:39:41
合計ジャッジ時間 5,004 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
10,920 KB
testcase_01 AC 6 ms
10,896 KB
testcase_02 AC 6 ms
10,916 KB
testcase_03 AC 185 ms
11,672 KB
testcase_04 AC 185 ms
11,660 KB
testcase_05 AC 39 ms
11,180 KB
testcase_06 AC 28 ms
11,044 KB
testcase_07 AC 127 ms
11,584 KB
testcase_08 AC 90 ms
11,548 KB
testcase_09 AC 52 ms
11,184 KB
testcase_10 AC 143 ms
11,512 KB
testcase_11 AC 134 ms
11,644 KB
testcase_12 AC 83 ms
11,408 KB
testcase_13 AC 28 ms
11,080 KB
testcase_14 AC 122 ms
11,740 KB
testcase_15 AC 36 ms
10,992 KB
testcase_16 AC 107 ms
11,456 KB
testcase_17 AC 86 ms
11,264 KB
testcase_18 AC 83 ms
11,480 KB
testcase_19 AC 106 ms
11,588 KB
testcase_20 AC 76 ms
11,320 KB
testcase_21 AC 69 ms
11,584 KB
testcase_22 AC 122 ms
11,428 KB
testcase_23 AC 16 ms
10,940 KB
testcase_24 AC 94 ms
11,608 KB
testcase_25 AC 96 ms
11,656 KB
testcase_26 WA -
testcase_27 AC 6 ms
10,904 KB
testcase_28 AC 176 ms
11,672 KB
testcase_29 AC 186 ms
11,664 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:23:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
 main(){
      ^

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;

int dp[10000][2][2][3][8],n,m,sum,p,A,k,M=1e9+7,f;
string s,t;

int dfs(int idx,bool tight=1,bool ok=0,int mod=0,int mod2=0){
  if(idx==s.size())return (ok||mod==0)&&mod2;
  int &res=dp[idx][tight][ok][mod][mod2];
  if(~res)return res;
  res=0;
  int x=s[idx]-'0';
  int r=tight?x:9;
  for(int i=0;i<=r;i++){
    res+=dfs(idx+1,tight&&i==r,ok||i==3,(mod*10+i)%3,(mod2*10+i)%8);
    res%=M;
  }
  return res;
}

main(){
  memset(dp,-1,sizeof(dp));
  cin>>s>>t;
  int A=dfs(0);
  swap(s,t);
  memset(dp,-1,sizeof(dp));
  int B=dfs(0);
  r(i,t.size()){
    sum=(sum*10+(t[i]-'0'))%24;
    if(t[i]=='3')f=1;
  }
  f=(f||sum%3==0)&&(sum%8);
  cout<<(B-A+M+f)%M<<endl;
}
0