更新一下,重新写一下,输入写到文件里,再重定向到输入就好:
#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
#define MAX_N 1000
typedef long long lint;
char num[MAX_N+5];int main() {int len = 0;while (~scanf("%s",num + len)) len += strlen(num + len);lint p = 1, zero_cnt = 0, ans = 0;for (int i = 0; num[i]; i++) {num[i] -= '0';if (num[i]) p *= num[i];else zero_cnt += 1;if (i - 13 < 0) continue;if (num[i - 13]) p /= num[i - 13];else zero_cnt -= 1;if (zero_cnt == 0 && p > ans) ans = p;}printf("%lld\n",ans);return 0;
}
结果:23514624000