eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

IP-адреса

опубліковано 14.10.17, 13:31:59

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

опубліковано 02.04.18, 19:10:17

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

опубліковано 03.01.24, 13:32:59

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;

}

опубліковано 05.02.24, 18:50:30

//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; } }