20150111을 출력합니다.
4가지 기준만 만족하면 됩니다.
182개의 풀이가 있습니다.
print(int('bzvxb',ord('$')))
string='aacddddd'
a=string.count('a')
b=string.count('b')
c=string.count('c')
d=string.count('d')
print(int(str(a)+str(b)+str(c)+str(d)+str(b)+str(c)+str(c)+str(c)))
Ruby
z, o, t, f = ['', ' ', ' ', ' '].map(&:size)
puts [t, z, o, f, z, o, o, t].join
단순하게 짰네요.
c언어로 작성했습니다.
#include <stdio.h>
enum {zero,one,two,three,four,five,six,seven,eight,nine,ten};
int main()
{
printf("%d%d%d%d%d%d%d%d\n",two,zero,one,five,zero,five,one,one);
return 0;
}
String word = "abcde";
String zero = word.indexOf("a")+"";
String one = word.indexOf("b")+"";
String two = word.indexOf("c")+"";
String five = word.length()+"";
String result = two+zero+one+five+zero+one+one+one+"";
System.out.println(result);
print(''.join([str(len('aa')),str(len('')),str(len('a')),str(len('aaaaa')),str(len('')),str(len('a')),str(len('a')),str(len('a'))]))
가장 단순무식한 방법입니다 ㅋㅋㅋ
using System;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int one = 'e'-'d';
int two = 'f'-'d';
int five = 'i'-'d';
int bak = 'd';
int ten = 'n'-'d';
int result = two*bak*bak*bak*ten + bak*bak*ten + five*bak*bak + bak + ten + one;
Console.WriteLine(result);
Console.ReadLine();
}
}
}
python 3.4
print(str(ord('c')-ord('a'))+str(ord('a')-ord('a'))+str(ord('b')-ord('a'))+str(ord('f')-ord('a'))+str(ord('a')-ord('a'))+str(ord('b')-ord('a'))+str(ord('b')-ord('a'))+str(ord('b')-ord('a')))
... 한참 고민했네요.. Soori 님이 문자열 빼기하신걸보고 저도 감잡았습니다.
그리고 오늘날짜 타임스탬프는 다음과 같이.. windows7 기준입니다.
#f=open('temp','w')
#f.close()
#import os
#test=os.popen('dir temp').read()
#import re
#os.remove('temp')
#a=re.search('(\d\d\d\d)-(\d\d)-(\d\d)',test)
#result=a.group(ord('b')-ord('a'))+a.group(ord('c')-ord('a'))+a.group(ord('d')-ord('a'))
#파일이름이나 경로를 사용은 했지만 출력은 하지 않았습니다. 그 부산물을 출력했을뿐... ㅎㅎㅎ
#print(result)
python 입니다. 그냥 단순한 방법을 사용했습니다.
ten = len("aaaaaaaaaa")
hundred = ten*ten
thousand = hundred*ten
print int(str(len("aa")*thousand+ten+len("aaaaa")) + str(len("")) + str(hundred+ten+len("a")))
zero, one, two, _, _, five = [*nil.to_i..nil.object_id]
puts [two, zero, one, five, zero, one, one, one].join
python 3.4
def convert(s):
r = ''
for i in s.upper():
r += str(ord(i)-ord('@'))
return r
print(convert('b@ae@aaa'))
java 8 입니다. class와 main method 생략
import static java.lang.System.out
"cabfabbb".chars().forEach(c -> out.println(c - 'a'))
l = len('s')
m = len('ss')
n = len('sssss')
print str(m**m*n)+str((m**m-l)*n)+str(l-l)+str(l)+str(l)+str(l)
좋은 풀이들은 이미 많아서 다르게 풀려고 했는데, 도찐개찐인 것 같네요. python 입니다.
8 def numa():
9 return ord('a') - ord('a')
10 def numb():
11 return ord('b') - ord('a')
12 def numc():
13 return ord('c') - ord('a')
14 def numd():
15 return ord('f') - ord('a')
16
17 a = str(numa())
18 b = str(numb())
19 c = str(numc())
20 d = str(numd())
21
22 print c + a + b + d + a + b + b + b
초보자로서 생각나는 젤 쉬운 방법이었는데 다른 풀이를 보니 너무 막강하네요 ㅠ
swift입니다. 정말 단순하게 풀어보았습니다. println안에 역슬래쉬가 안들어가네요
import UIKit
var zero=countElements("");
var one=countElements("a");
var two=countElements("aa");
var five=countElements("aaaaa");
println("\(two)\(zero)\(one)\(five)\(zero)\(one)\(one)\(one)")
c++입니다.
#include <stdio.h>
void main()
{
char a[]={'$','h','@',false};
char b[]={'%','h',false,false};
printf("%o\n",*(int *)a+*(int*)b);
}
문자열하고 포인터를 살짝 만져봤습니다 ㅎ;
c로 극단적으로 하면
main()
{
printf("%o",*((int *)"$h@")+*(int *)"%h");
}
쓰레기값 들어갈것 같았는데 안나와서 확인해보니 메모리 정렬이되서 안나오네요 핰;;
java 입니다.
public class NumberConvert {
public int getNumber(String input, char ch){
return input.indexOf(ch);
}
}
테스트 코드 입니다. 코드 안에 숫자를 빼다보니, 테스트 코드에 값 검증이 없습니다.
public class NumberConvertTest {
/**
* * 20150111을 출력합니다.
*/
@Test
public void test() {
String input = "Hello World!";
char two = 'l'; char one = 'e'; char five = ' ';
char zero = 'H';
NumberConvert converter = new NumberConvert();
String expected =
""+ //문자로 표현하기 위해서...
converter.getNumber(input, two)+
converter.getNumber(input, zero)+
converter.getNumber(input, one)+
converter.getNumber(input, five)+
converter.getNumber(input, zero)+
converter.getNumber(input, one)+
converter.getNumber(input, one)+
converter.getNumber(input, one);
System.out.println(expected);
}
}
암호화/복호화 떠올리며 만들어 보았습니다. 복호화 알고리즘이 중요한 건 아니라 앞서 많이들 작업하신 빼기로 진행해 보았습니다. python 3.4.2입니다.
encoded = 'arhoib`k'
keycode = 'critical'
decoded = ''
for i in range(len(encoded)):
decoded += str( ord(keycode[i]) - ord(encoded[i]) )
print(decoded)
Java
public class printNumNotUsingNumber {
public static void main(String args[]){
int tmp = 'A' -'A';
int zero = tmp;
int one = ++tmp;
int two = ++tmp;
int five = two+two+one;
System.out.println(String.format("%d%d%d%d%d%d%d%d",two , zero , one , five , zero , one , one , one));
}
}
단순하게 풀어봤습니다.
zero=str(len(''))
one=str(len('a'))
two=str(len('aa'))
five=str(len('aaaaa'))
print(two+zero+one+five+zero+one+one+one)
Using python 크.. 어떻게하면 더 쉽게 풀 수 있을까요..ㅠㅠ
print ((ord('A')*ord('L')+ord('@'))*ord('=')+ord('<'))*ord('B')+ord('/')
<?
echo strlen("ab").strlen("").strlen("x").strlen("asdfg").strlen("").strlen("s").strlen("]").strlen("s");
?>
이러면 안되는건가요?
C로 풀었습니다. 아스키코드를 이용해서 풀었네요^^
char arr[]={'c'-'a', 'a'-'a', 'b'-'a', 'f'-'a',
'a'-'a', 'b'-'a', 'b'-'a', 'b'-'a'};
char *ptr_arr=arr;
int num=sizeof(arr)/sizeof(char);
while(num--){
printf("%d",*ptr_arr);
ptr_arr++;
}
Sub main()
Dim s As String = "꾕꾐꾑꾹꾐꾑꾑꾑"
For Each c As Char In s
Console.Write(Chr(Asc(c) - Asc("꺄")))
Next
Console.ReadLine()
End Sub
아스키코드를 이용해보았습니다.
public static string Print()
{
Encoding enc = Encoding.UTF8;
byte[] arr = Convert.FromBase64String("MjAxNTAxMTE=");
return enc.GetString(arr);
}
이렇게 꼼수를 써서 풀어도 되나 싶네요 ㅎㅎ;
```{.cpp}
int main() { char a,b,c,d,e,f; a='a'; b='b'; c='c'; d='d'; e='e'; f='f'; printf("%d%d%d%d%d%d%d%d",f-d,f-f,f-e,f-a,f-f,f-e,f-e,f-e); } ```아스키 코드를 이용해서 한번 해봤습니다. ^^ 갓 시작한 저한테는 아무래도 이것밖에 방법이 안보여서요...
int main() { char a,b,c,d,e,f; a='a'; b='b'; c='c'; d='d'; e='e'; f='f'; printf("%d%d%d%d%d%d%d%d",f-d,f-f,f-e,f-a,f-f,f-e,f-e,f-e); }
Python 2.7
print ord('(')*ord('>')*ord('A')*ord('}')+ord('o')
ord의 개수를 최대한 줄여 봤습니다. 이 방법으로는 4개는 불가능할 것으로 생각됩니다.
static void exce78()
{
System.out.printf("%d", 'c'-'a');
System.out.printf("%d", 'a'-'a');
System.out.printf("%d", 'b'-'a');
System.out.printf("%d", 'f'-'a');
System.out.printf("%d", 'a'-'a');
System.out.printf("%d", 'b'-'a');
System.out.printf("%d", 'b'-'a');
System.out.printf("%d", 'b'-'a');
}
간단하게 해 봤습니다
a = ' '; b = ' '; e = ' '; nul = ''
print(str(len(b)) + str(len(nul)) + str(len(a)) + str(len(e)) + str(len(nul)) + str(len(a)) + str(len(a)) + str(len(a)))
그냥 길이를 값으로 환산하고 다시 문자열로 환산했습니다.
static void Main(string[] args)
{
int two = 'c' - 'a';
int zero = 'c' - 'c';
int one = 'b' - 'a';
int five = 'f' - 'a';
Console.WriteLine(two.ToString() + zero.ToString() + one.ToString() + five.ToString() + zero.ToString() + one.ToString() + one.ToString() + one.ToString());
}
```{.cpp}
int main(void)
{ printf("%d%d%d%d%d%d%d%d\n", sizeof(wchar_t), sizeof(char) - sizeof(char), sizeof(char), sizeof(int) + sizeof(char),sizeof(char) - sizeof(char),sizeof(char), sizeof(char), sizeof(char));
return 0;
}
numa = len("aa")
numb = len("")
numc = len("a")
numd = len("aaaaa")
nume = len("")
numf = len("a")
numg = len("a")
numh = len("a")
print str(numa) + str(numb) + str(numc) + str(numd) + str(nume) + str(numf) + str(numg) + str(numh)
저는 이게 한계인거 같습니다.
파이썬 공부한지 2달째인데 기본문법 공부하고 응용이 안 되서 고민하다 한참만에 코딩도장을 찾아서 문제를 풀어보는데 문제들이 만만치가 않네요. 처음문제라 쉬운거 찾다가 그래도 쉬워보여서 선택했는데 그래도 어려워서 "김보근님" "임진승님" 답보고 힌트를 얻었습니다. 그래도 조금은 다르게 풀어보려고 노력했습니다. 가입인사 겸 문제풀이네요.
알파벳을 최대한 안 쓰고 풀려고 노력했고 길지 않게 하려했는데 만만치가 않네요. 오랜고민끝에 답안을 제출합니다.
a=len('a')
aa=str(len('a'))
aaa=str(len('aaaaa'))
print(str(a+a)+str(a-a)+aa+aaa+str(a-a)+aa+aa+aa)
파이썬 3.5 입니다.
c++로 작성하였습니다.
#include <iostream>
using namespace std;
int main()
{
int One = 'd' - 'P',
Two = 'd' - 'U',
Thr = 'd' - 'd',
Fou = 'd' - 'c',
Fiv = 'd' - 'Y';
cout << One << Two << Thr << Fou << Fiv << endl;
return 0;
}
파이썬 2.7
def decrypt(s):
result = ''
for i in s:
result += str(ord(i)-ord('a'))
return result
print decrypt('cabfabbb')
#numbers=map(lambda x: ord(x)-ord('P'),"PQRSTUVWXY") from 0~9
########################################0123456789
numbers=map(lambda x: ord(x)-ord('P'),"RPQUPQQQ")
print "".join(str(i) for i in numbers)
lsta = [".",".",".",".","."]
lstb=[".","."]
lstc=["."]
lstd=[]
print len(lstb), len(lstd), len(lstc), len(lsta), len(lstd), len(lstc), len(lstc), len(lstc)
C# 입니다.
foreach (var c in "cabfabbb")
Console.Write(c - 'a');
혹은
"cabfabbb".ToList().ForEach(c => Console.Write(c - 'a'));
Ruby
두가지로 품. # 1.33진수로 출력 2.unicode문자로 출력 (07DF, 006F)
p "gwnae".to_i("!".ord) #=>20150111
p "ߟo".codepoints.map{|_|'%04d'%_}*'' #=>"20150111"
Test
expect("gwnae".to_i("!".ord)).to eq 20150111
1번 풀이
# 20150111을 11~36진수로 변환(숫자를 포함하면 필터링). 획득한 유효문자열 중 하나로 n진수 변환/출력.
bit_str = ->n { [20150111.to_s(n), n, n.chr] }
(11..36).map(&bit_str).reject {|e|e[0]=~/\d/}
#=> [["lpbqi",31,"\x1F"], ["gwnae",33,"!"], ["bzvxb",36,"$"]]
static int i;
void makeNumber() {
int zero = i;
int one = ++i;
int two = ++i;
int five = one + two + two;
System.out.println("" + two + zero + one + five + zero + one + one + one);
}
java
파이썬3.4입니다. 리스트의 인덱스번호를 반환하는 함수를 사용하였습니다.
A = 'abcdef'
c = 'cabfabbb'
for i in c:
print(A.index(i), end = '')
package printf;
public class printf {
public static void main(String args[]) {
System.out.print('c'-'a');
System.out.print('a'-'a');
System.out.print('b'-'a');
System.out.print('f'-'a');
System.out.print('a'-'a');
for(int i=0; i<3; i++) {
System.out.print('b'-'a');
}
}
}
a="aa"
b=""
c="a"
d="aaaaa"
print("%d%d%d%d%d%d%d%d"%(len(a),len(b),len(c),len(d),len(b),len(c),len(c),len(c)))
Python 3.4.4
print(str(ord("c") - ord("a")) + \
str(ord("a") - ord("a")) + \
str(ord("b") - ord("a")) + \
str(ord("f") - ord("a")) + \
str(ord("a") - ord("a")) + \
str(ord("b") - ord("a")) + \
str(ord("b") - ord("a")) + \
str(ord("b") - ord("a")))
무식의결정체 ㅎㅎ
zero = ''
one = 'a'
two = 'aa'
three = 'aaa'
four = 'aaaa'
five = 'aaaaa'
print(len(two), len(zero), len(one), len(five), len(zero), len(one), len(one), len(one))
C#으로 작성했습니다.
public int PrintNumber(string input)
{
int one = 'e' - 'd';
int two = 'f' - 'd';
int five = 'i' - 'd';
int bak = 'd';
int ten = 'n' - 'd';
return two * bak * bak * bak * ten + bak * bak * ten + five * bak * bak + bak + ten + one;
}
for x in range(ord('l')-ord('a')):exec(chr(ord('a')+x)+''' = str(x)''')
print(c+a+b+f+a+b+b+b)
파이썬 3.5.1
a = str(len("aa"))+str(len(""))+str(len("a"))+str(len("aaaaa"))+str(len("")) +str(len("a"))+str(len("a"))+str(len("a"))
print(a)
python입니다 하드코딩같네요 ㅎㅎ
def solve(var):
a,b,c,d='i','ii','iiiii',''
j = ''
for i in var:
j += str(len(eval(i)))
return int(j)
solve('bdacdaaa')
파이썬3입니다. (문제 바로 밑에 최고추천답이 올라와서, 가끔 의도치 않게 스포를 당하는 기분이 들어요.) 하나하나 신기한 해법들이네요ㅎ
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <string>
using namespace std;
int main(void) {
int cnum[] = { 'a' - 'a','b' - 'a','c' - 'a', 'f' - 'a' };
// 0 1 2 5
cout << cnum[2] << cnum[0] << cnum[1] << cnum[3] << cnum[0] << cnum[1] << cnum[1] << cnum[1] << endl;
system("pause");
return 0;
}
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class PrintNumber {
public static void main(String[] args) {
}
public String printNumber() {
String result = "";
String zero = 'a' - 'a' + "";
String one = 'b' - 'a' + "";
String two = 'c' - 'a' + "";
String five = 'f' - 'a' + "";
result += two + zero + one + five + zero + one + one + one;
return result;
}
@Test
public void testPrintNumber() {
assertEquals("20150111", printNumber());
}
}
Java 로 작성했습니다.
package Questions;
public class PrintWithoutNumber {
public static void main(String[] args) {
// TODO Auto-generated method stub
// 2015111
String solution = "world!";
int two = solution.indexOf('r');
int zero = solution.indexOf('w');
int one = solution.indexOf('o');
int five = solution.indexOf('!');
System.out.println(String.format("%d%d%d%d%d%d%d", two, zero, one, five, one, one, one));
}
}
#python 2.7.xx
r = str(ord('x') - ord('d'))
e = str(ord('K') + ord('K'))
s = str(ord('o'))
result = r + e + s
풀면서도 어이가 없네요 ㅋㅋ
print(str(ord('A')+ord('A')+ord('G'))+str(ord('s')-ord('A'))+str(ord('o')))
#### 2016.12.31 D-418 ####
ㅠㅠ 한계...
Console.WriteLine(
$"{'f' - 'd'}" +
$"{'d' - 'd'}" +
$"{'e' - 'd'}" +
$"{'i' - 'd'}" +
$"{'d' - 'd'}" +
$"{'e' - 'd'}" +
$"{'e' - 'd'}" +
$"{'e' - 'd'}");
#include <stdio.h>
void PlusZero(unsigned int& x)
{
x <<= true;
}
void PlusOne(unsigned int& x)
{
x <<= true;
x += true;
}
void main()
{
unsigned int x = false;
// 0001
PlusOne(x);
// 0011
PlusZero(x);
PlusZero(x);
PlusOne(x);
PlusOne(x);
// 0011
PlusZero(x);
PlusZero(x);
PlusOne(x);
PlusOne(x);
// 0111
PlusZero(x);
PlusOne(x);
PlusOne(x);
PlusOne(x);
// 0111
PlusZero(x);
PlusOne(x);
PlusOne(x);
PlusOne(x);
// 0101
PlusZero(x);
PlusOne(x);
PlusZero(x);
PlusOne(x);
// 1111
PlusOne(x);
PlusOne(x);
PlusOne(x);
PlusOne(x);
printf("%d", x);
}
주석에 숫자는 봐주세요...
허접하지만 올려봅니다.. ㅋ
list_x = [' ', '', ' ', ' ', '', ' ', ' ', ' ']
def pr(list_tt):
return str(len(list_tt))
result = ''.join(map(pr, list_x))
print result
ze=int(False)
on=int(True)
tw=on+on
fi=tw+tw+on
print(str(tw)+str(ze)+str(on)+str(fi)+str(ze)+str(on)+str(on)+str(on))
python 3.5.2
answer is '20150111'
a=len('aa')
b=len('')
c=len('a')
d=len('aaaaa')
e=len('')
f=len('a')
g=len('a')
h=len('a')
print(str(a)+str(b)+str(c)+str(d)+str(e)+str(f)+str(g)+str(h))
public class NumberPrint {
public static void main(String[] args) {
char a = 'a', b = 'b', c = 'c', f = 'f';
System.out.printf("%d%d%d%d%d%d%d%d", c - a, a - a, b - a, f - a, a - a, b - a, b - a, b - a);
}
}
lst = ['a','b','c','d','e''f','g','h']
n = "aacdddddfgh"
def num(n):
for i in lst:
print n.count(i),
num(n)
public static void main(String[] args) {
// TODO Auto-generated method stub
String a = "a",b="b",c="c",f="f";
System.out.print(c.compareTo(a));
System.out.print(a.compareTo(a));
System.out.print(b.compareTo(a));
System.out.print(f.compareTo(a));
System.out.print(a.compareTo(a));
System.out.print(b.compareTo(a));
System.out.print(b.compareTo(a));
System.out.print(b.compareTo(a));
}
import string
arr = [string.ascii_lowercase.index('c'),
string.ascii_lowercase.index('a'),
string.ascii_lowercase.index('b'),
string.ascii_lowercase.index('f'),
string.ascii_lowercase.index('a'),
string.ascii_lowercase.index('b'),
string.ascii_lowercase.index('b'),
string.ascii_lowercase.index('b')]
print (int(''.join([str(n) for n in arr])))
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace practice2
{
class code78
{
public void Run()
{
string str = "abcdef";
Console.Write(str.IndexOf("c"));
Console.Write(str.IndexOf("a"));
Console.Write(str.IndexOf("b"));
Console.Write(str.IndexOf("f"));
Console.Write(str.IndexOf("a"));
Console.Write(str.IndexOf("b"));
Console.Write(str.IndexOf("b"));
Console.Write(str.IndexOf("b"));
Console.WriteLine();
}
}
}
int zero = 'a' - 'a';
int one = 'b' - 'a';
int two = 'c' - 'a';
int five = 'f' - 'a';
System.out.println(String.valueOf(two) + zero + one + five + zero + one + one + one);
Python 3.6, alphabet 10의 index 를 사용합니다.
'''(조건)
코드 내에 숫자가 없어야 합니다.
파일 이름이나 경로를 사용해서는 안됩니다.
시간, 날짜 함수를 사용해서는 안됩니다.
에러 번호 출력을 이용해서는 안됩니다.
'''
def num_by_alpha(string):
alpha = ['a','b','c','d','e','f','g','h','i']
num = ''
for x in string:
num += str(alpha.index(x))
return int(num)
>>> num_by_alpha('cabfabbb')
20150111
(첨가: 5/25) '투플러스'님의 답변에 감동을 받아 저도 36진수 한번 써봅니다. baseconv.py 를 install 했다는 가정하에 다음과 같이 하면 가능합니다.
>>> from baseconv import base36
>>> print(base36.decode('bzvxb'))
20150111
c로 풀이. 두가지 방법.
#include <stdio.h>
int main(void)
{
int two='c'-'a';
int zero='a'-'a';
int one='b'-'a';
int five='f'-'a';
int twoo=sizeof(int)-sizeof(char)-sizeof(char);
int onee=sizeof(char);
int fivee=sizeof(int)+sizeof(char);
int zeroo=sizeof(int)-sizeof(int);
printf("%d%d%d%d%d%d%d%d\n",two,zero,one,five,zero,one,one,one);
printf("%d%d%d%d%d%d%d%d",twoo,zeroo,onee,fivee,zeroo,onee,onee,onee);
return 0;
}
public static void main(String[] args) {
int i='a'-'a';
int zero = 'a'-'a';
int one= ++i;
int two = ++i;
int five = two +two + one;
System.out.println(""+two+zero+one+five+zero+one+one+one);
}
Python으로 풀었습니다. 음.. 뭔가 더 좋은 답들이 있을 것 같네요.
for s in ['aa', '', 'a', 'aaaaa', '', 'a', 'a', 'a']:
print(len(s), end='')
def f(str1):
a = 'abcdefghijklmnopqrstuvwxyz'
print(''.join([str(a.index(x)) for x in str1]))
f('cabfabbb')
zero, one, two, five = '', 'a', 'ab', 'abcde'
def INT(lst):
return ''.join([str(len(x)) for x in lst])
print(INT([two, zero, one, five, zero, one, one, one]))
public class Example78 {
public static void main(String[] args) {
String s = "cabfabbb";
for (char c : s.toCharArray()) {
System.out.print(c - 'a');
}
}
}
static void Main(string[] args)
{
int a = 'a';
int c = 'c';
Console.Write(c - a);
a = 'a';
c = 'a';
Console.Write(c - a);
a = 'a';
c = 'b';
Console.Write(c - a);
a = 'a';
c = 'f';
Console.Write(c - a);
a = 'a';
c = 'a';
Console.Write(c - a);
a = 'a';
c = 'b';
Console.Write(c - a);
a = 'a';
c = 'b';
Console.Write(c - a);
a = 'a';
c = 'b';
Console.Write(c - a);
}
A='abcdefghij'
B={}
for x,y in enumerate(A):
B[y]=str(x)
print(B['c']+B['a']+B['b']+B['f']+B['a']+B['b']*int(B['d']))
# 파이썬
j = str(len(''))
a = str(len('a'))
b = str(len('aa'))
c = str(len('aaa'))
d = str(len('aaaa'))
e = str(len('aaaaa'))
print(b+j+a+e+j+a+a+a)
#include <iostream>
using namespace std;
int main() {
cout << (int)('c' - 'a') << (int)('a' - 'a') << (int)('b' - 'a') << (int)('b' - 'a');
cout << (int)('a' - 'a') << (int)('b' - 'a') << (int)('b' - 'a') << (int)('b' - 'a');
return 0;
}
#include <iostream>
static int idx;
int main() {
char carr[] = { 'i', 'K', 'N', '!'};
std::cout << carr[idx++]-'U'<< carr[idx]+carr[idx++]<< carr[idx++]+carr[idx];
}
c++, 아스키코드를 이용했습니다.
string='abcdef'
ans=''
ans+=str(string.index('c'))
ans+=str(string.index('a'))
ans+=str(string.index('b'))
ans+=str(string.index('f'))
ans+=str(string.index('a'))
ans+=str(string.index('b'))
ans+=str(string.index('b'))
ans+=str(string.index('b'))
print(ans)
five = '*****'
print(str(int(len(five)/len(five)+len(five)/len(five)))+str(len(five)-len(five))+str(int(len(five)/len(five)))+str(len(five))+str(len(five)-len(five))+str(int(len(five)/len(five)))+str(int(len(five)/len(five)))+str(int(len(five)/len(five))))
print(ord(''), end = "")
print(ord(''), end = "")
print(ord('2'), end = "")
print(ord('o'), end = "")
Swift입니다.
let zero = [].count
let one = [""].count
let two = one + one
let five = two + two + one
print("\(two)\(zero)\(one)\(five)\(zero)\(one)\(one)\(one)")
int a; // 전역변수는 0으로 자동 초기화
void main() {
int b = ++a; // b=1
a--;
int c = ++b; // c=2
b--;
printf("%d%d%d%d",c,a,b,c+c+b);
printf("%d%d%d%d\n",a,b,b,b);
}
#include <iostream>
using namespace std;
int main()
{
char a = 'a';
char b = 'b';
char c = 'c';
int zero = a - a;
int one = b - a;
int two = c - a;
int five = two * two + one;
cout << two << zero << one << five << zero << one << one << one << endl;
return 0;
}
char형의 차이를 이용하여 int로 출력한다.
String길이로 되게 단순하게 표현해봤습니다.
public class Number_Print {
public static void main(String[] args) {
String zero = "";
String one = "a";
String five = "aaaaa";
System.out.println(one.length()+one.length()+""+zero.length()+""+one.length()+""+five.length()+""+zero.length()+""+one.length()+""+one.length()+""+one.length());
}
}
VBA로 작성했어요. VBA는 없어서 VB.net ㅋ
Sub AscNum()
MsgBox Asc("") & Asc("") & Len("") & Asc("") & Asc("")
End Sub
str_input = "aacdddddfgh"
str_item = ["a", "b", "c", "d", "e", "f", "g", "h"]
result = []
for s in str_item:
result.append(str(str_input.count(s)))
print("".join(result))
package outputNum;
public class outputNum {
public static void main(String[] args) {
System.out.print("d".hashCode() + "e".hashCode());
System.out.print("x".hashCode() - "F".hashCode());
System.out.print("o".hashCode());
}
}
t = int('k',ord(' '))
f = int('f',ord(' '))
o = int('a',ord(' '))
e = int('b',ord(' '))
print(t,f,str(o)[::-1],e,sep='')
아스키 코드가 아직 안나왔네요!
아스키 코드로 풀었습니다.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
// 20150111을 출력합니다.
// 4가지 기준만 만족하면 됩니다.
// 코드 내에 숫자가 없어야 합니다.
// 파일 이름이나 경로를 사용해서는 안됩니다.
// 시간, 날짜 함수를 사용해서는 안됩니다.
// 에러 번호 출력을 이용해서는 안됩니다.
function output() {
const b = String('亶'.charCodeAt())
const bb = String('o'.charCodeAt())
const answer = b+bb
return answer
}
</script>
</body>
</html>
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String word = "kkkkkkkkkkkkkkkkkkkk";
String wordd = "k";
String word2 = "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk";
String word3 = "a";
System.out.print(word.length());
System.out.print(wordd.length());
System.out.print(word2.length());
System.out.print(word3.length());
System.out.print(word3.length());
System.out.print(word3.length());
}
}
public class Test
{
public static void main(String[] args)
{
int temp = 'a';
int[] arr ={'c','a','b','f','a','b','b','b'};
String str="";
System.out.println(str);
int f1;
for(f1=num('a','a');f1<arr.length;f1++)
{
str +=String.valueOf(arr[f1]-temp);
}
System.out.println(str);
}
static int num(int ori, int minus)
{
return ori-minus;
}
}
Z=[]
a=['a']
aa=['a','a']
aaaaa=['a','a','a','a','a']
result=str(len(aa))+str(len(Z))+str(len(a))+str(len(aaaaa))+str(len(Z))+str(len(a))+str(len(a))+str(len(a))
print(result)
a <- 'a'
b <- 'ab'
c <- 'abc'
d <- 'abcd'
e <- 'abcde'
paste(nchar(b), nchar(a) - nchar(a), nchar(a), nchar(e), nchar(a) - nchar(a), nchar(a), nchar(a), nchar(a), sep = '')
static int number;
public static void main(String [] args){
int zero =number;
int one =++number;
int two =++number;
int five = two + two + one;
System.out.println("결과는 ->"+ two + zero + one + five + zero + one + one + one);
}
x = ['a','a','b','c','c','c','c','c']
print(str(x.count('a')) + str(x.count('d')) + str(x.count('b')) + str(x.count('c'))
+ str(x.count('d')) + str(x.count('b')) + str(x.count('b')) + str(x.count('b')))
namespace codingdojang__
{
class Program
{
static void Main(string[] args)
{
string two = " ";
string zero = "";
string one = " ";
string five = " ";
Console.WriteLine($"{two.Length}{zero.Length}{one.Length}{five.Length}{zero.Length}{one.Length}{one.Length}{one.Length}");
}
}
}
#include<iostream>
using namespace std;
int main(void)
{
char a = 'a';
char b = 'b';
char d = 'd';
char e = 'e';
char f = 'f';
cout << f - d << f - f << f - e << f - a << f - f << f - e << f - e << f - e;
}
number_print = ord('d')*ord('d')*ord('d')*ord('\n')+ord('d')*ord('d')*ord('d')*ord('\n')+ord('d')*ord('d')*ord('\n')\
+ord('d')*ord('\n')*ord('/')+ord('d')*ord('\n')+ord('d')*ord('\n')+ord('d')*ord('\n')+ord('"')+ord('M')
print(number_print)
#20150111
std = ord('a')
zero = std - std
one = ord('b') - std
two = ord('c') - std
five = ord('f') - std
result1 = str(two) + str(zero) + str(one) + str(five) + str(zero) + str(one) + str(one) + str(one) + str(one)
zero = len('')
one = len('a')
two = len('aa')
five = len('aaaaa')
result2 = str(two) + str(zero) + str(one) + str(five) + str(zero) + str(one) + str(one) + str(one) + str(one)
print(result1, result2)
b = [] a = ['이','공','일','오','공','일']
for i, j in enumerate(a): b.append(i)
print(b[2],b[0],b[1],b[-1],b[0],(str(b[1]) * 3))
비쥬얼 스튜디오 2017로 작성했습니다. cpp 입니다. 아스키 코드를 이용하여 출력하였습니다.
#include "config.h"
void main() {
int a = 'z' - 'f';
int b = 'P' + 'F';
int c = 'o';
printf("%d%d%d", a, b, c);
}
string='aacddddd'
a=string.count('a')
b=string.count('b')
c=string.count('c')
d=string.count('d')
print(int(str(a)+str(b)+str(c)+str(d)+str(b)+str(c)+str(c)+str(c)))
mystr = ['a','b','c','d','e','f']
print(mystr.index('c'), end="")
print(mystr.index('a'), end="")
print(mystr.index('b'), end="")
print(mystr.index('f'), end="")
print(mystr.index('a'), end="")
print(mystr.index('b'), end="")
print(mystr.index('b'), end="")
print(mystr.index('b'), end="")
s=input();ans=''
for i in s:
ans+=chr(int(i)+ord('A')-ord('0'))
print(ans)
사실 문제가 무엇을 기준으로 출력을 하라는것인지 잘 이해를 못 하여서, 그냥 정말 말 그대로 '임의'대로 그려보았읍니다.
result=str(ord('u')-ord('a'))+str((ord('p')-ord('a')))
result=result+str(ord('a')-ord('a'))+str(ord('b')-ord('a'))+str(ord('l')-ord('a'))
print(result)
sum=['a','b','c','d','e','f']
zero = sum.index('a') one = sum.index('b') two = sum.index('c') three = sum.index('d') four = sum.index('e') five = sum.index('f')
print(str(two)+str(zero)+str(one)+str(five)+str(zero)+str(one)+str(one)+str(one))
counting_space = lambda input_str : input_str.count(' ')
print(''.join(list(map(str,map(counting_space,[' ','',' ',' ','',' ',' ',' '])))))
``````{.python}
cnta = lambda input_str : input_str.count(' ')
print(''.join(list(map(str,map(cnta,[' ','',' ',' ','',' ',' ',' '])))))
tex = "iuuuuuyy"
comz, como, comt, comf = str(tex.count("3")), str(tex.count("i")), str(tex.count("y")), str(tex.count("u"))
comt+comz+como+comf+comz+como*3
string = "aacdddddfgh"
result = list((map(str,[string.count("a"),string.count("b"),string.count("c"),string.count("d"),string.count("e"),string.count("f"),string.count("g"),string.count("h")])))
print("".join(result))
python으로 작성했습니다.
a="aacddddd"
a1=str(a.count("a"))
a2=str(a.count("b"))
a3=str(a.count("c"))
a4=str(a.count("d"))
year=a1+a2+a3+a4+a2+a3+a3+a3
print(year)
today="aab"
one=today.count("b")
two=today.count("a")
zero=today.count("c")
print(str(two)+str(zero)+str(two)+str(zero)+str(zero)+str(one)+str(two)+str(zero)) #20200120
20150111을 출력해봐도 됐지만, 저도 한번 오늘 날짜인 20200120을 출력해봤습니다. ㅎㅎ
Input = 'ABCDEFGHIJ'
zero = str(Input.find('A'))
one = str(Input.find('B'))
two = str(Input.find('C'))
three = str(Input.find('D'))
four = str(Input.find('E'))
five = str(Input.find('F'))
six = str(Input.find('G'))
seven = str(Input.find('H'))
eight = str(Input.find('I'))
nine = str(Input.find('J'))
Output = two + zero + one + five + zero + one + one
print(Output)
#include <iostream>
#include <set>
using namespace std;
/*
20150111을 출력합니다.
4가지 기준만 만족하면 됩니다.
코드 내에 숫자가 없어야 합니다.
파일 이름이나 경로를 사용해서는 안됩니다.
시간, 날짜 함수를 사용해서는 안됩니다.
에러 번호 출력을 이용해서는 안됩니다.
*/
int main() {
multiset<char> s;
s.insert('a');
s.insert('a');
s.insert('c');
s.insert('b');
s.insert('b');
s.insert('b');
s.insert('b');
s.insert('b');
cout << s.count('a') << s.count('d') << s.count('c') << s.count('b') << s.count('d') << s.count('c') << s.count('c') << s.count('c') << endl;
}
print(chr(ord('R')-ord(' '))+chr(ord('P')-ord(' '))+chr(ord('Q')-ord(' '))+chr(ord('U')-ord(' '))+chr(ord('P')-ord(' '))+chr(ord('Q')-ord(' '))+chr(ord('Q')-ord(' '))+chr(ord('Q')-ord(' ')))
z = ''
a = 'a'
b = 'bb'
c = 'ccc'
d = 'dddd'
e = 'eeeee'
print(str(len(b)) + str(len(z)) + str(len(a)) + str(len(e)) + str(len(z)) + str(len(a)) + str(len(a)) + str(len(a)))
무식하죠? .. ㅜ
print(str(len('aa'))+str(len(''))+str(len('a'))+str(len('aaaaa'))+str(len(''))+str(len('a'))+str(len('a'))+str(len('a')))
def print_num_without_num():
def to_num(s): return ord(s) - ord("a")
return "".join([str(to_num(i)) for i in "cabfbbbb"])
s = 'aacdddddfgh'
i = s.count('a')
j=s.count('b')
k=s.count('c')
l=s.count('d')
m=s.count('e')
n=s.count('f')
o=s.count('g')
p=s.count('h')
print(i,j,k,l,m,n,o,p)
public class test5 {
public static void main(String[] args) {
String a = "aaaaa";
String b = "aa";
String c = "a";
String d = "";
System.out.print(b.length()+""+d.length()+""+c.length()+""+a.length()+""+d.length()+""+c.length()+""+c.length()+""+c.length()+"");
}
}
이래도 되려나 모르겠네요..ㅎㅎ;;
package codeDojang;
public class Prac {
public static void main(String[] args) {
String word = "abced";
int two = word.indexOf("c");
int zero = word.indexOf("a");
int one = word.indexOf("b");
int five = word.length();
System.out.println(two+
""+zero+one+five+zero+one+one+one);
}
}
print(''.join([str(len('aa')),str(len('')),str(len('a')),str(len('aaaaa')),str(len('')),str(len('a')),str(len('a')),str(len('a'))]))
가장 단순한 방법입니다.
print(ord('U')-ord('A'),end='')
print(ord('P')-ord('A'),end='')
print(ord('A')-ord('A'),end='')
print(ord('B')-ord('A'),end='')
print(ord('L')-ord('A'))
>>> a = str(len("ab")) + str(len("")) + str(len("a"))
>>> b = str(len("abcde")) + str(len(""))
>>> c = str(len("a")) + str(len("a")) + str(len("a"))
>>> result = int(a + b + c)
>>> result
20150111
Python 3.9.1입니다.
ord 이용해서 하는 방법 깔끔하네요 ㅎ
a = ['**','','*','*****','','*', '*', '*']
print(''.join(str(len(x)) for x in a))
q= "aabcccccd"
w = q.count("a")
e = q.count("b")
r = q.count("c")
t = q.count("d")
z= q.count("w")
print("%d%d%d%d%d%d%d%d"%(w,z,e,r,z,t,t,t))
36진수를 사용해서 풀줄은 몰랐네요...
a = ' '
b = ''
c = ' '
d = ' '
_list = [len(a), len(b), len(c), len(d), len(b), len(c), len(c), len(c)]
for i in range(len(_list)):
_list[i] = str(_list[i])
print(''.join(_list))
['a','b','c','d','e','f']
print(str(A.index('c'))+str(A.index('a'))+str(A.index('b'))+str(A.index('f'))+str(A.index('a'))
+str(A.index('b'))+str(A.index('b'))+str(A.index('b')))
package loop;
public class Ex10 {
public static void main(String[] args) {
int test = 'A' - 'A';
int zero = test;
int one = ++test;
int two = ++test;
int five = one + two + two;
System.out.printf("%d%d%d%d%d%d%d%d",two,zero,one,five,zero,one,one,one);
}
}
java
st= "abbccccc"
a = str(st.count("a"))
b = str(st.count("b"))
c = str(st.count("c"))
d = str(st.count("d"))
print(b+d+a+c+d+a+a+a)
list=['a', 'b', 'b', 'c', 'c', 'c', 'c', 'c']
A=str(list.count('a'))
B=str(list.count('b'))
C=str(list.count('c'))
D=str(list.count('d'))
result=B+D+A+C+D+A+A+A
print(result)
a1='aa'#20150111
a2=''
a3='a'
a4='aaaaa'
a5=''
a6='a'
a7='a'
a8='a'
b1=len(a1)
b2=len(a2)
b3=len(a3)
b4=len(a4)
b5=len(a5)
b6=len(a6)
b7=len(a7)
b8=len(a8)
print(b1,b2,b3,b4,b5,b6,b7,b8,sep'')
def number_print(a,c):
k = ''
for i in c:
k += str(a.index(i))
return k
print(a,c)
if __name__ == '__main__':
a = 'abcdef'
c = 'cabfabbb'
print(number_print(a,c))
a =["a","b","c","d","e","f"]
b = a.index
print(b("c"),b("a"),b("b"),b("f"),b("a"),b("b"),b("b"),b("b"))
quiz = ['**', '', '*', '*****', '', '*', '*', '*']
out = ""
for i in range(len(quiz)):
out += str(len(quiz[i]))
print(out)
cmd = 'a,a,c,d,d,d,d,d,f,g,h'.split(',')
a = cmd.count('a')
b = cmd.count('b')
c = cmd.count('c')
d = cmd.count('d')
e = cmd.count('e')
f = cmd.count('f')
g = cmd.count('g')
h = cmd.count('h')
print(f"{a}{b}{c}{d}{e}{f}{g}{h}")
너무 무식하게 한거같네요 더욱 간단히 할 수 있는 방법이 많네요
#20150111 출력하기
num = ('z','a','b','c','d','e')
print(str(num.index("b"))+str(num.index("z"))+str(num.index("a"))+str(num.index("e"))+str(num.index("z"))+str(num.index("a"))+str(num.index("a"))+str(num.index("a")))
package codingDojang;
public class CodingDojang471 {
public static void main(String[] args) {
// 20150111을 출력합니다.
// 4가지 기준만 만족하면 됩니다.
//
// 1. 코드 내에 숫자가 없어야 합니다.
// 2. 파일 이름이나 경로를 사용해서는 안됩니다.
// 3. 시간, 날짜 함수를 사용해서는 안됩니다.
// 4. 에러 번호 출력을 이용해서는 안됩니다.
String result = "";
int[] nums = {'U' - 'A', 'P' - 'A', 'a'-'a', 'o' };
for (int i = 0; i < nums.length; i++) {
result += nums[i];
}
System.out.println(result);
}
}
def print_magic_number():
# 1. 아스키 코드를 이용해 필요한 숫자(0, 1, 2, 5)를 문자열로 생성
# '0' 만들기: ord('a') - ord('a') 결과는 숫자 0. 이를 str()로 문자열 '0'으로 변환.
zero = str(ord('a') - ord('a'))
# '1' 만들기: ord('b') - ord('a') 결과는 숫자 1. 이를 str()로 문자열 '1'으로 변환.
one = str(ord('b') - ord('a'))
# '2' 만들기: ord('c') - ord('a') 결과는 숫자 2. 이를 str()로 문자열 '2'로 변환.
two = str(ord('c') - ord('a'))
# '5' 만들기: ord('f') - ord('a') 결과는 숫자 5. 이를 str()로 문자열 '5'로 변환.
five = str(ord('f') - ord('a'))
# 2. 생성된 숫자 문자열들을 순서대로 이어 붙여 최종 문자열 생성
result_string = two + zero + one + five + zero + one + one + one
# 3. 최종 숫자 배열 출력
print(int(result_string))
# 함수 호출
print_magic_number()
# 20150111을 출력하는 함수
# 아스키 코드 기준, a는 97이고 A는 65이다.
# ord() 함수는 문자의 아스키 코드 값을 반환
#
def print_magic_number():
# 1. 아스키 코드를 이용해 필요한 숫자(0, 1, 2, 5)를 문자열로 생성
# '0' 만들기: ord('a') - ord('a') 결과는 숫자 0. 이를 str()로 문자열 '0'으로 변환.
zero = str(ord('a') - ord('a'))
# '1' 만들기: ord('b') - ord('a') 결과는 숫자 1. 이를 str()로 문자열 '1'으로 변환.
one = str(ord('b') - ord('a'))
# '2' 만들기: ord('c') - ord('a') 결과는 숫자 2. 이를 str()로 문자열 '2'로 변환.
two = str(ord('c') - ord('a'))
# '5' 만들기: ord('f') - ord('a') 결과는 숫자 5. 이를 str()로 문자열 '5'로 변환.
five = str(ord('f') - ord('a'))
# 2. 생성된 숫자 문자열들을 순서대로 이어 붙여 최종 문자열 생성
result_string = two + zero + one + five + zero + one + one + one
# 3. 최종 문자열 출력
print(int(result_string))
# 함수 호출
print_magic_number()