标签:one math 比较 return 出现 ref inpu blank 多少
此博客链接:https://i-beta.cnblogs.com/posts/edit-done;postId=12343866
剪花布条
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2087
#include<stdio.h> #include<math.h> #include<stdlib.h> #include<string.h> int main() { char huabutiao[1000]; char minshitiao[1000]; while (scanf("%s%s", huabutiao, minshitiao)) { if (huabutiao[0] == ‘#‘) break; int i = 0; int j = 0; int k = 0; int str1; int str2; str1 = strlen(huabutiao); str2 = strlen(minshitiao); int count1=0; int count = 0; for (i = 0; i < str1; i = i + str2) { count1 = 0; for (j = 0, k = i; k < i + str2, j < str2; k++, j++) { if (huabutiao[k] == minshitiao[j]) count1++; else break; } if (count1 == str2) count++; } printf("%d\n", count); } return 0; }
标签:one math 比较 return 出现 ref inpu blank 多少
原文地址:https://www.cnblogs.com/ping2yingshi/p/12343866.html