mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-01-11 16:31:58 +00:00
CF25B Phone numbers
R40341264
This commit is contained in:
parent
3ece123c57
commit
f91f4de358
20
problem/CF25B/CF25B.cpp
Normal file
20
problem/CF25B/CF25B.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n;
|
||||
string s;
|
||||
cin >> n >> s;
|
||||
for (int i = 0; i < n; i++) {
|
||||
cout << s[i];
|
||||
if (i % 2 && n % 2 && i < n - 4 || i % 2 && !(n % 2) && i != n - 1) {
|
||||
cout << '-';
|
||||
}
|
||||
if (i == n - 4 && n % 2) {
|
||||
cout << '-' << s[n - 3] << s[n - 2] << s[n - 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user