#include #define rep(i,n) for(int i=0;i> s; int n = s.size(); if(is_pm){ if(s[0] == '-'){ string t; rep(i, n - 1) t += s[i + 1]; swap(s, t); n--; } } assert(n >= 6); int dot = -1; rep(i, n){ if(s[i] == '.'){ // multiple . is NG if(dot != -1) assert(false); dot = i; continue; } assert(s[i] - '0' >= 0 && s[i] - '0' <= 9); } // just integer is NG assert(dot != -1); // .0 .00 .000 is NG assert(dot == n - 5); // 00.0000 is NG int zero = 0; rep(i, dot){ if(s[i] == '0') zero++; else zero -= 100; } assert(zero <= 1); long long INT = 0; rep(i, n){ if(s[i] == '.') continue; INT *= 10; INT += s[i] - '0'; } // 0 < A <= 1e9, -1e9 <= B <= 1e9 if(is_pm) assert(0 <= INT <= 1000000000); else assert(0 < INT <= 1000000000); } int main(){ varify(false); varify(true); return 0; }