220 DIV2 B. Inna and Nine
2017-11-08 14:15
316 查看
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
View Code
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
相关文章推荐
- 220 DIV2 B. Inna and Nine
- Codeforces Round #220 (Div. 2)C题:Inna and Dima(记忆化搜索+DP)
- 220 DIV2 A. Inna and Pink Pony
- 220 DIV2 A. Inna and Pink Pony
- B. Inna and Nine
- codeforces round #234B(DIV2) C Inna and Huge Candy Matrix
- Codeforces Round #234 (Div. 2):B. Inna and New Matrix of Candies
- Codeforces Round #234 (Div. 2) A. Inna and Choose Options 模拟题
- Codeforces Round #234 (Div. 2) B. Inna and New Matrix of Candies SET的妙用
- Codeforces Round #229 (Div. 2) C. Inna and Candy Boxes 树状数组s
- Codeforces Round #229 (Div. 2)A. Inna and Alarm Clock
- Codeforces Round #234 (Div. 2):B. Inna and New Matrix of Candies
- Codeforces Round #229 (Div. 2) B. Inna, Dima and Song
- Codeforces Round #229 (Div. 2) A. Inna and Alarm Clock
- Codeforces Round #220 (Div. 2) A. Inna and Pink Pony 这个题目不简单的
- Codeforces Round #234 (Div. 2) :A. Inna and Choose Options
- CodeForces 374 B. Inna and Nine
- Codeforces Round #229 (Div. 2) A. Inna and Alarm Clock
- Codeforces Round #234 (Div. 2) A. Inna and Choose Options
- Codeforces Round #229 (Div. 2)B. Inna, Dima and Song