Submission #6573925


Source Code Expand

Copy
#include <stdio.h>
#include <string.h>
#define DIV 1000000007

int main(){
  char S[100002],tmp[100002];
  int N;
  int cnt[2][13];
  int mod;
  
  scanf( "%s", tmp);
  N = strlen(tmp);
  for(int i=0;i<N;i++)
    S[i] = tmp[N-1-i];
  
  for(int i=0;i<13;i++)
    cnt[1][i] = 0;
  mod = 1;
  cnt[1][0] = 1;
  
  for( int i=0; i<N; i++){
    if ( S[i] == '?' ){
      for( int j=0; j<13; j++)
	cnt[i%2][j] = 0;
      for( int n=0; n<10; n++)
	for( int j=0; j<13; j++)
	  cnt[i%2][(j+n*mod)%13] = (cnt[i%2][(j+n*mod)%13]+cnt[(i+1)%2][j]) % DIV;
    }else
      for( int j=0; j<13; j++)
	cnt[i%2][(j+(S[i]-'0')*mod)%13] = cnt[(i+1)%2][j];

    mod = (mod*10)%13;
  }  
    
  printf("%d\n",cnt[(N-1)%2][5]);
  
  return 0;
}

Submission Info

Submission Time
Task D - Digits Parade
User FlatHarvest
Language C (GCC 5.4.1)
Score 400
Code Size 759 Byte
Status AC
Exec Time 48 ms
Memory 384 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:11:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf( "%s", tmp);
   ^

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 30
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Subtask1 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt
Case Name Status Exec Time Memory
sample_01.txt AC 0 ms 128 KB
sample_02.txt AC 0 ms 128 KB
sample_03.txt AC 0 ms 128 KB
sample_04.txt AC 1 ms 128 KB
sub1_01.txt AC 13 ms 256 KB
sub1_02.txt AC 18 ms 256 KB
sub1_03.txt AC 1 ms 128 KB
sub1_04.txt AC 1 ms 128 KB
sub1_05.txt AC 15 ms 256 KB
sub1_06.txt AC 1 ms 128 KB
sub1_07.txt AC 1 ms 128 KB
sub1_08.txt AC 6 ms 384 KB
sub1_09.txt AC 37 ms 384 KB
sub1_10.txt AC 25 ms 256 KB
sub1_11.txt AC 1 ms 128 KB
sub1_12.txt AC 1 ms 128 KB
sub1_13.txt AC 0 ms 128 KB
sub1_14.txt AC 0 ms 128 KB
sub1_15.txt AC 0 ms 128 KB
sub1_16.txt AC 0 ms 128 KB
sub1_17.txt AC 48 ms 384 KB
sub1_18.txt AC 14 ms 384 KB
sub1_19.txt AC 31 ms 384 KB
sub1_20.txt AC 31 ms 384 KB
sub1_21.txt AC 4 ms 384 KB
sub1_22.txt AC 4 ms 384 KB
sub1_23.txt AC 4 ms 384 KB
sub1_24.txt AC 31 ms 384 KB
sub1_25.txt AC 0 ms 128 KB
sub1_26.txt AC 0 ms 128 KB