-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathj.cpp
39 lines (35 loc) · 917 Bytes
/
j.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// North American Invitational Programming Contest 2015
// Problem: J - Zig Zag Nametag
// Problem Set: http://naipc.uchicago.edu/2015/_static/naipc2015.pdf
// Verdict: Accepted
// By Andre Saboia [University of Nebraska at Omaha]
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
#include <cmath>
#define F first
#define S second
#define db(x) cout << #x << " == " << x << endl
#define _ << " _ " <<
using namespace std;
int n;
char x[] = {'n','o','o','p','p','q','q','r','r','s','s','t','t','u','u','v','v','w','w','x','x','y','y','z','z'};
int main(){
scanf("%d", &n);
if(n>25){
int o = 1+ (int)ceil(n/25.0);
printf("a%c", x[(n-1)%25]);
for (int i = 0; i < o-3; ++i)
{
printf("%c", i&1?'z':'a');
}
printf("%c\n", (((n-25-1)/25)&1)?((n&1)?'z':'y'):((n&1)?'b':'a') );
}
else{
printf("a%c\n", (char)(n+'a'));
}
return 0;
}