Skip to content

Instantly share code, notes, and snippets.

View mizushou's full-sized avatar
:octocat:
Working from home

Shouhei.Mizuno mizushou

:octocat:
Working from home
View GitHub Profile
import java.io.BufferedReader;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String l = br.readLine();
int c = 0;
for(int i = 0; i < 6; i++) {
if(l.charAt(i) == '1') {
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int w = sc.nextInt();
System.out.println((n * n) - w);
}
}
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String l1 = br.readLine();
String l2 = br.readLine();
int n = Integer.parseInt(l1);
int k = Integer.parseInt(l2);
@mizushou
mizushou / Xxfestival.java
Created October 8, 2017 17:32
CODE FESTIVAL 2017 qual B 問題A
import java.util.Scanner;
class Xxfestival {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String str = scan.next();
int l =str.length();
System.out.println(str.substring(0, l-8));
}
}
import java.util.Scanner;
class LinearSearch {
static boolean search(int[] A, int n, int key) {
int i = 0;
//番兵法
A[n] = key;
while(true) {
if(A[i] == key) {
break;
import java.util.ArrayList;
class ArrayListDemo1 {
public static void main(String[] args) {
//1. addしてみる
ArrayList<Integer> array = new ArrayList<>();
System.out.println("===========");
System.out.println("Before add");
System.out.println("===========");
System.out.println("array size : " + array.size());
class TimeMeasurement {
public static void main(String[] args) {
long start = System.nanoTime();
// some processing
int[] a = {1,2,3,4,4,5,6,7,8,9,10};
for(int i=0; i<a.length; i++){
System.out.println(a[i]);
};
import java.util.Scanner;
class ConvertToIntArray {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("配列のサイズを入力してください。");
int n = sc.nextInt();
int[] A = new int[n];
System.out.println("配列の要素を空白区切りで入力してください。");
for(int i=0; i<n; i++){
@mizushou
mizushou / Factorial.java
Last active October 19, 2017 02:09
* nの階乗を計算する再帰関数 * 漸化式 : n! = n * (n-1)
class Factorial {
//階乗を求める再帰関数
static int factorial(int n) {
if(n==1) {
return 1;
}
return n * factorial(n-1);
}
@mizushou
mizushou / SimilarArrays.java
Last active October 24, 2017 23:59
# 171022 Code festival 予選 C * 問題 * http://code-festival-2017-qualc.contest.atcoder.jp/ * 解説 * https://img.atcoder.jp/code-festival-2017-qualc/editorial.pdf * その他 * Javaのべき乗って演算子ないんだ、しかもMath.powはdoubleしかない。めんどう
import java.util.Scanner;
public class SimilarArrays {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] A = new int[n];
for(int i=0; i<n; i++){
A[i] = sc.nextInt();
};