首页 > 代码库 > 220 DIV2 B. Inna and Nine

220 DIV2 B. Inna and Nine

220 DIV2 B. Inna and Nine

input

369727

output

2

input

123456789987654321

output

1

题意:比如例子1:369727-->99727-->9997 , 369727-->99727-->9979

14545181例子2:14545181-->1945181-->194519-->19919,

         14545181-->1945181-->199181-->19991

但是:14545181-->149591这是错的

注意:使用__int64

 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <cstdlib> 5 #include <iostream> 6 #define M 100005 7 char s[M]; 8  9 int main()10 {11     //freopen("in.txt","r",stdin);12     while(~scanf("%s",s))13     {14         int i,n;15         n=strlen(s);16         __int64 ans=1;17         for(i=0;i<n;i++)18         {19             if(s[i]-0+s[i+1]-0==9 && i+1<n)20             {21                 __int64 c=1;22                 while(s[i]-0+s[i+1]-0==9)23                 {24                     c++;25                     i++;26                 }27                 if(c%2==0)28                 ans*=1;29                 else30                 ans*=(c/2+1);31             }32         }33         printf("%I64d\n",ans);34     }35     return 0;36 }
View Code

 

220 DIV2 B. Inna and Nine