很恶心的字符串模拟题,主要是测试点很恶心。
测试点0:样例的情况,样例能过这个就能过
测试点1:除数是0的情况,特判输出
测试点2:除数是单数,输出“The average of 1 number is Y”,注意number后面没有s!!!
测试点3:最恶心的一个测试点,因为把形如“123.”,小数点在最后一位的数也算作合法数了,题目并没有明确说明,我一直以为小数点在最后也是非法的,找了好久TvT
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
bool isclegal(char c){
if(!(c>='0'&&c<='9') && c!='-' && c!='.') return false;
return true;
}
bool isslegal(string s){
int dian =