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                 else
30                 ans*=(c/2+1);
31             }
32         }
33         printf("%I64d\n",ans);
34     }
35     return 0;
36 }
View Code

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值