Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N = int(input()) ans = "" while N != 0: N -= 1 ans += chr(ord('a') + N % 26) N //= 26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; int main(){ long long n; cin >> n; string ans=""; while(n>0){ --n; ans += 'a'+ n%26; n /= 26; } reverse(ans.begin(),ans.end()); cout << ans << endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
# include <iostream> using namespace std; int main(){ long long n; cin>>n; string s=""; while(n--){ s="a"+s; s[0]+=(n%26); n/=26; } cout<<s<<endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
s = int(input()) c= "" while(s!=0): s-=1 c+=chr(ord('a')+s%26) s=s//26 print(c[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); sc.close(); int tmp; String ans = ""; while (N > 0){ N-=1; tmp = (int) (N % 26); ans += (char)(tmp + 'a'); N /= 26; } for(int i=ans.length();i>0;--i){ S...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long num = sc.nextLong(); num--; String result = ""; String alp = "abcdefghijklmnopqrstuvwxyz"; while (true) { long syou = num / alp....
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N=int(input()) s="" while(N>0): c=N%26 N=N//26 if c==0: N-=1 if c!=0: s=chr(96+c)+s else: s=chr(96+26)+s print(s)
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); long n = in.nextLong(); long m = n; String ans = ""; while (m > 0) { if (m % 26 == 0) { ans = 'z' + ans; m...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n=int(input()) ans="" d="abcdefghijklmnopqrstuvwxyz" while n!=0: n-=1 ans+=d[n%26] n//=26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n=int(input()) ans='' check='abcdefghijklmnopqrstuvwxyz' while n!=0: n-=1 ans+=check[n%26] n//=26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; #define int long long int32_t main() { int n;cin>>n; string ans=""; while(n>0) { int d=(n-1)%26; ans=(char)(d+'a') + ans; n--; n/=26; } cout<<ans<<endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; int main(){ long long n; cin>>n; string s; while(n){ n--; s+='a'+n%26; n/=26; } reverse(s.begin(),s.end()); cout<<s<<endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n = int(input()) out = "" while n > 0: n -= 1 out += chr(ord('a') + n % 26) n //= 26 print(out[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = Long.parseLong(sc.next()); int c = 'a'; StringBuilder sb = new StringBuilder(); while (n != 0) { long remainder = (n - 1) % 26; sb.append((char) (c + remainder)); ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main(){ long long n; cin>>n; string ret; while(n){ n--; char d = (n % 26) +'a'; ret = d + ret; n /= 26; } cout<<ret<<endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; int main(){ long long n; string s=""; cin >>n; while(n>0){ n-=1; s+=char(n%26 +97); n/=26; } reverse(s.begin(),s.end()) ; cout << s << endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); long n = scan.nextLong(); StringBuilder name = new StringBuilder(); int surplus; for (; n > 0; n = (n - 1) / 26) { surplus = (int) ((n ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n=int(input()) c = "" while(n!=0): n-=1 c+=chr(ord('a')+n%26) n=n//26 print(c[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main { public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); long n = sc.nextLong(); StringBuilder builder = new StringBuilder(); while (n > 0) { long e = (n - 1) % 26; ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; import java.util.function.*; import java.lang.*; import java.io.*; public class Main { static String dogName(long N){ if(N==0) return ""; return dogName((N-1)/26)+((char)((N-1)%26 + 'a')); } public static void main(String[] args) { Scanner sc = new Scanner(Syste...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); long N = sc.nextLong(); StringBuilder ans = new StringBuilder(); while(N > 0){ long kari = N % 26l; if(kari == 0) kari = 26; char alp...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin >> N; string S=""; while(N){ N--; int A=N%26; char B='a'+A; S.push_back(B); N/=26; } reverse(S.begin(),S.end()); cout << S << endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ char[] alphabet = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; Scanner sc = new Scanner(System.in); long n = sc.nextLong(); // n -= 1; ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n=int(input()) ans="" while n>0: n -=1 n,b=divmod(n,26) ans +=chr(97+b) print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N = int(input()) ans = '' while N != 0: N -= 1 ans += chr(ord('a') + N%26) N //= 26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); long n=sc.nextLong(); String ans=""; int c=0; String s="abcdefghijklmnopqrstuvwxyz"; String[] a=s.split(""); while(n>0){ long b1=n/(long)Math.pow(26,c); ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static final int MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = Long.parseLong(sc.next()); StringBuilder sb = new StringBuilder(); while (n > 0) { long mo...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { long N = Long.parseLong(sc.next()); StringBuilder ans = new StringBuilder(); while(N > 0) { N--; ans.insert(...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main(){ unsigned long long n; cin>>n; string s; while(n){ n--; s+='a'+(n%26); n/=26; } reverse(s.begin(),s.end()); cout<<s<<endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N = int(input()) s = "" while N != 0: N -= 1 r = N % 26 s += chr(ord('a') + r) N //= 26 print(s[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; string s=""; int main(){ ios::sync_with_stdio(false); cin.tie(0); long long n; cin>>n; while(n--){ s=char(n%26+'a')+s; n/=26; } cout<<s; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<iostream> using namespace std; int main(){ string s;long long n;cin>>n; while(n--){ s=char(97+n%26)+s; n/=26; } cout<<s; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main(){ unsigned long long n; cin>>n; string s; while(n){ //nが1以上 n--; s+='a'+(n%26); n/=26; } reverse(s.begin(),s.end()); cout<<s<<endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n=int(input()) ans=[] while n!=0: n=n-1 ans.append(chr(n%26+97)) n=n//26 ans.reverse() print("".join(ans))
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n; cin>>n; string ans=""; while(n){ n--; ll x=n%26; char c=('a'+x); ans=c+ans; n/=26; } cout<<ans; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main { static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;} public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); String ans = ""; String s = "zabcdefghijklmnopqrstuvwxy"; char[] c = s...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main{ public static void main(String[] args){ Scanner scan = new Scanner(System.in); long n = scan.nextLong(); Stack<Character> stac = new Stack<>(); while(n > 0){ if(n%26 == 0){ stac.add('z'); n /= 26; n--; }else{ stac.add((char)('a'+n%26 - 1)); n /= 26...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); StringBuilder sb = new StringBuilder(); long n; n = scanner.nextLong(); //System.out.println(n); while(n > 26) { int rem = (int) (n % 26); //System.out.println...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; long long int s,t,num[50],n; int main() { scanf("%lld",&s); while(s) { t=(s-1)%26; num[n]=t; s=(s-1)/26; n++; } for(int i=n-1;i>=0;i--) printf("%c",num[i]+'a'); }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); Long N = sc.nextLong(); String name = ""; while(N>0){ N = N-1; String x = String.valueOf(Character.toChars((int)(N%26)+97)); name = x.conc...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N = int(input()) ans = '' while N: m = (N+25) % 26 ans += chr(ord('a') + m) N = (N-m) // 26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; int main(){ long long n; cin>>n; string ans=""; while(n>0){ n--; ans+=(n%26)+'a'; n/=26; } reverse(ans.begin(),ans.end()); cout<<ans; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String args[]) { char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray(); Scanner scan = new Scanner(System.in); long n = scan.nextLong(); StringBuilder name = new StringBuilder(); int surplus; ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main(){ long long n; cin>>n; string ans; while(n){ n -= 1; ans += (char)('a'+ n%26); n/= 26; } reverse(ans.begin(),ans.end()); cout<<ans; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String o=""; long n=sc.nextLong(); while(n>0){ long a=n%26; if(a!=0)o=(char)(96+a)+o; else o="z"+o; n=n/26; if(a==0)n-...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long N = scan.nextLong(); String answer = ""; while (N > 0) { N--; answer = (char) ('a' + (N % 26)) + answer; N = N / 26; } System.out.println(answer); } }
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N = int(input()) ans = "" while N>0: N -= 1 num = N%26 ans += chr(ord("a")+num) N //= 26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner sc = new Scanner(System.in)) { long num = sc.nextLong() - 1; String name = ""; while (num >= 0) { int mod = (int) (num % 26); name = ((char) ('a' + mod) + name); num = num / 26 - 1; } Syst...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> #define int long long using namespace std; signed main() { int n; cin>>n; string s=""; while(n!=0){ int k=n%26; if(k==0){ k=26; n--; } s=char(k+'a'-1)+s; n/=26; } cout<<s; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long n,syou; int mod; char c; string ans; cin >> n; while(n!=0){ n=n-1; syou=n/26; mod=n%26; c='a'+mod; ans=c+ans; n=syou; } cout << ans <<endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N = int(input()) ans = '' while N > 0: N -= 1 ans = chr(N%26+97) + ans N //= 26 print(ans)
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); String res = func(n); System.out.println(res); } public static String func(long n) { n--; if(n <= 25 && 0 <= n) return Character.toString((char)(...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; long long n; int main() { cin>>n; string s; while(n) { long long d=(n-1)%26; s.insert(s.begin(),'a'+d); n=(n-1)/26; } cout<<s<<endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll n; cin>>n; string ans=""; while(n>0){ ans+= ('a' + (n-1)%26); n=(n-1)/26; } reverse(ans.begin(),ans.end()); cout<<ans<<'\n'; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <iostream> #include <algorithm> using namespace std; int main(){ long n; cin >> n; string arr=""; while(n>0){ n--; arr += (char)(97+n%26); n/=26; } //cout<<arr; reverse(arr.begin(),arr.end()); cout<<arr; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n = int(input()) s = [] while n > 0: n -= 1 s.append(chr(n % 26 + 0x61)) n //= 26 print(''.join(reversed(s)))
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main() { long long n; cin>>n; string ans; while(n>0) { n--; ans += n%26+'a'; n = n/26; } reverse(ans.begin(),ans.end()); cout<<ans<<endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main() { long long int n; cin>>n; string r; while(n>0) { n--; r= string(1,('a'+(n%26)))+r; n/=26; } cout<<r<<endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); long input = scanner.nextLong(); StringBuilder sbr = new StringBuilder(); while ( input > 0 ){ input -= 1; sbr.append( (char) ( ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main() { long long int n; cin>>n; string a=""; while(n){ n--; int z=(n%(int)26); char x=z+'a'; a+=x; n/=26; } reverse(a.begin(),a.end()); cout<<a; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); long N=sc.nextLong(); int maxlen=12; long[] space=new long[maxlen]; space[0]=1; int ketasu=0; String ans=""; for(int i=1; i<maxlen; i++) { space[i]=space[i-1]*26; } for(int i=1; i<m...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); int[] bits = new int[12]; //26進数を記録 int top = 0; //26進表記何桁か //26進数に変換 while(n > 0) { bits[top] = (...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n = int(input()) s = '' while n > 0: d = (n-1)%26 n = (n-1) // 26 s = chr(d + ord('a')) + s print(s)
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n = int(input()) ans = '' while n: n -= 1 ans = chr(n%26 + ord('a')) + ans n //= 26 print(ans)
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
s = raw_input() n = int(s) def main(n): d = 1 n -= 1 while n - 26**d >= 0: n -= 26**d d += 1 ret = '' for i in range(d): ret += chr((n%26)+ord('a')) n //= 26 return ret[::-1] print main(n)
PYTHON
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N=int(input()) ans=list() while N>0: N-=1 ans.append(chr(ord("a")+N%26)) N//=26 print("".join(ans[::-1]))
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); StringBuilder sb = new StringBuilder(); for (; N > 0; N = (N - 1) / 26) sb.append((char) ((N - 1) % 26 + 'a')); System.out.println(sb.revers...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main(){ long long N; cin >> N; string S=""; while(N){ N--; int A=N%26; N/=26; char a='a'+A; S.push_back(a); } reverse(S.begin(),S.end()); cout << S << endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long n = scan.nextLong(); String[] str = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n = int(input()) ans = '' while n > 0: n -= 1 ans += chr(n % 26 + ord('a')) n = n // 26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); long n = in.nextLong(); StringBuilder answer = new StringBuilder(); while (n > 0) { n--; answer.append((char) ('a' + n % 26)); ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); String alphabet = "abcdefghijklmnopqrstuvwxyz"; String name = ""; while(n > 0){ n--; long remain = n % 26l; name = alphabet.charAt...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); long n=sc.nextLong(); StringBuilder res=new StringBuilder(); while(n-- > 0) { //System.out.println(n); res.append((char)('a'+(n%26))); n/=26; } System.out.println(re...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { /** 英文字のアルファベット */ private static final char[] ALPHABET = "abcdefghijklmnopqrstuvwxyz".toCharArray(); public static void main(String[] args) { try (Scanner scanner = new Scanner(System.in)) { long n = scanner.nextLong(); StringBuilder sb = new StringBuilder();...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N=int(input()) ans='' while N>0 : N-=1 ans += chr(ord('a')+N%26) N//=26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <iostream> #include <algorithm> using namespace std; int main(){ long n; cin >> n; string arr=""; while(n>0){ n--; arr += (char)(97+n%26); n/=26; } reverse(arr.begin(),arr.end()); cout<<arr; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public final class Main { public static void main(String[] args) { final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); final long n = Long.parseLong(in.nextLine()); ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; int main(){ long long N; cin >> N; string S=""; while(N){ N--; char C='a'+(N%26); S+=C; N/=26; } reverse(S.begin(),S.end()); cout << S << endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; int main() { long long n,k; cin >> n; string s=""; char c; while(n>0){ n--; k=n%26; n/=26; c='a'+k; s.push_back(c); } reverse(s.begin(),s.end()); cout << s << endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <algorithm> #include <iostream> using namespace std; int main(){ long long N; cin >> N; string ans; while(N > 0){ --N; ans += (N%26) + 'a'; N /= 26; } reverse(ans.begin(), ans.end()); cout << ans << endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n = int(input()) - 1 ans = "" while(n>=0): ans += chr(ord("a") + n%26) n = n//26 - 1 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); long x = n; String res = ""; while (x != 0) { int r = (int)(x % 26); if (r == 0) { r = ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<bits/stdc++.h> using namespace std; int main() { long long int n; string ans; cin>>n; while(n){ n--; ans+='a'+n%26; n/=26; } reverse(ans.begin(), ans.end()); cout<<ans<<endl; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N=int(input()) ans='' while N>0: res=(N-1)%26 ans=chr(ord('a')+res)+ans N=(N-1)//26 print(ans)
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include <bits/stdc++.h> using namespace std; //動画解答写し string f(long long n){ if(n==0)return ""; n--; return f(n/26)+string(1,'a'+n%26); } int main(){ long long n; cin>>n; cout<<f(n)<<endl; return 0; }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); String[] list = new String[26]; char tmp = 'a'; for (int i = 0; i < 26; i++) { list[i] = String.valueOf(tmp++); } String ans = ""; ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n = int(input()) ans = "" while n > 0: n -= 1 ans = chr(ord('a') + n%26) + ans n //= 26 print(ans)
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ Scanner sc = new Scanner(System.in); long n = sc.nextLong(); sc.close(); String[] list = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); long n = Long.parseLong(buffer.readLine()); Strin...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); n--; List<Character> ansList = new ArrayList<>(); while (n>=0) { ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n=int(input()) res="" while n!=0: mod=(n-1)%26 n=(n-1)//26 res+=chr(97+mod) print(res[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
#include<cstdio> void print(long long x){ if(x==0)return; if(x%26==0)print((x/26)-1),putchar('z'); else print(x/26),putchar('a'+(x%26)-1); } int main(){ long long x;scanf("%lld",&x); print(x),puts(""); }
CPP
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N = int(input()) ans = "" while N > 0: N -= 1 ans += chr(97 + N%26) N //= 26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
from copy import deepcopy N=input() n=deepcopy(N) total=0 for l in range(1,12): n-=26**l if n<=0: break total+=26**l N-=total+1 ans="" for i in range(l-1,-1,-1): ans+=chr(N/(26**i)+97) N%=(26**i) print ans
PYTHON
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N = int(input()) ans = "" while N>0: N -= 1 s = N%26 ans += chr(s + 97) N = (N-s)//26 print(ans[::-1])
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.math.BigDecimal; import java.util.Scanner; /** * @author : Ritchie Zhang * @date : 2020/5/10 * @description: TODO * @modifiedBy: * @version: 1.0 */ public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); long a = s.nextLong(); Syst...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n=int(input()) a="zabcdefghijklmnopqrstuvwxy" b="" while n/26>0: b=a[n%26]+b n=(n-1)//26 print(b)
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws IOException { final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); long n = ...
JAVA
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
N=int(input()) name="" while N>0: N-=1 name=chr(ord("a")+N%26)+name N//=26 print(name)
PYTHON3
p02629 AtCoder Beginner Contest 171 - One Quadrillion and One Dalmatians
1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows: * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`; * the dogs numbered 27,28,29,\...
6
0
n = int(input()) ans = "" while n: n -= 1 ans += chr(97 + n % 26) n //= 26 print(ans[::-1])
PYTHON3