This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#define rep(i, n) for(int i = 0; i < (n); ++i) | |
using namespace std; | |
int main(void){ | |
int n; | |
cin >> n; | |
rep(i, n) { | |
cout << i << endl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
cout << "何か入力してください >"; | |
int n; | |
cin >> n; | |
cout << "入力値: " << n << endl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def double_list(lst): | |
if lst == []: | |
return [] | |
head = lst[0] | |
tail = lst[1:] | |
return [head * 2] + double_list(tail) | |
print(double_list([1, 2, 3])) # [2, 4, 6] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VolatileSample { | |
volatile boolean shutdownRequested = false; | |
public static void main(String[] args) { | |
var v = new VolatileSample(); | |
v.run(); | |
} | |
private void run() { | |
var th = new Thread( () -> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
while True: | |
print('文字を一文字入力してください >', end='') | |
char = input().rstrip() | |
if len(char) != 1: | |
print('入力可能な文字は一文字です') | |
continue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table = {'1': '一', '2': '二', '3': '三', '4': '四'} | |
print('プログラムを開始します。終了の際は999を入力して下さい。') | |
while True: | |
print('番号を入力して下さい。(1~4) > ', end='') | |
num = input().rstrip() | |
if num == '999': | |
print('お疲れ様でした。') | |
break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 1 | |
while x <= 9 | |
y = 1 | |
while y <= 9 | |
print x.to_s + " × " + y.to_s + " = " + (x * y).to_s | |
print "\t" | |
y += 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
public class Alphabet3 { | |
public static void main(String[] args) { | |
final List<Character> LIST = List.of('u', 'd', 'c', 's', 't', 'b'); | |
for(Character c1 : LIST) { | |
for(Character c2 : LIST) { | |
for(Character c3 : LIST) { | |
System.out.println("" + c1 + c2 + c3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VarSample { | |
public static void main(String[] args) { | |
var str = "test"; | |
System.out.println(str.toUpperCase()); | |
var o = new Object() { | |
public int sum(int x, int y) { | |
return x + y; | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.io.IOException; | |
import java.text.NumberFormat; | |
import static java.lang.System.out; | |
public class Calc | |
{ | |
public static void main(String[] args) |