eolymp
bolt
Try our new interface for solving problems
Problems

IP-address

published at 10/14/17, 1:31:59 pm

Есть тесты, где находится две точки подряд.

published at 4/2/18, 7:10:17 pm

^ чоткий чувак

published at 1/3/24, 1:32:59 pm

include <bits/stdc++.h>

using namespace std; using ll = long long;

int main() { iosbase::syncwith_stdio(0); cin.tie(0);

string s;
cin >> s;
int eded = 0;
if(s[0] == '.' || s[s.size()-1] == '.') {cout << 0; return 0;}
s += '.';
for(int i=0; i<s.size(); i++){
    if(s[i] == '.' && s[i+1] == '.') {cout << 0; return 0;}
    if(s[i] != '.'){
        eded *= 10;
        eded += s[i]-'0';
    } else {
        if(eded > 255 || eded < 0){
            cout << 0;
            return 0;
        }
        eded = 0;
    }
}
cout << 1;

}

published at 2/5/24, 6:50:30 pm

//authour Nicat Huseynli

include <iostream>

using namespace std; int main() { int a , b , c , d; char a1 , b1 , c1; cin>>a>>a1>>b>>b1>>c>>c1>>d; if(a < 256 and b < 256 and c < 256 and d < 256 and a1 == '.' and b1 == '.' and c1 == '.'){ cout<<1; } else{ cout<<0; } }