buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
public class Main { public static void main(String[] args) { java.util.Scanner scan = new java.util.Scanner(System.in); int[] x = new int[6]; for (int i = 0; i < 6; i++) { x[i] = scan.nextInt(); } String str = scan.nextLine(); int n = str.length(); for (int i = 0; i < n; i++) { ...
public class Main { public static void main(String[] args) { java.util.Scanner scan = new java.util.Scanner(System.in); int[] x = new int[6]; for (int i = 0; i < 6; i++) { x[i] = scan.nextInt(); } String str = scan.next(); int n = str.length(); for (int i = 0; i < n; i++) { S...
[["-", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22], ["+", 8, 196, 0, 503, 49, 200, 51, 492, 141, 22]]
3
370
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); String[] line = sc.nextLine().split(" "); int[] label = new int[line.length]; for (int i = 0; i < label.length; i++)...
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner sc = new Scanner(System.in); String[] line = sc.nextLine().split(" "); int[] label = new int[line.length]; for (int i = 0; i < label.length; i++)...
[["-", 8, 527, 0, 520, 0, 1, 0, 11, 12, 22], ["+", 8, 527, 0, 520, 0, 1, 0, 11, 12, 22]]
3
502
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] surface = br.readLine().split(" "); String[] order = br...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] surface = br.readLine().split(" "); String[] order = b...
[["-", 64, 196, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 64, 196, 0, 1, 0, 11, 12, 16, 12, 22], ["-", 75, 57, 75, 196, 0, 1, 0, 11, 31, 22], ["+", 75, 57, 75, 196, 0, 1, 0, 11, 31, 22], ["-", 75, 196, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 75, 196, 0, 1, 0, 11, 12, 16, 12, 22]]
3
428
import java.util.Scanner; class Main { public static void main(String[] args) { int[] sary = new int[6]; String rollpattern; Scanner stdIn = new Scanner(System.in); for (int i = 0; i < sary.length; i++) { sary[i] = stdIn.nextInt(); } stdIn.nextLine(); rollpattern = stdIn.nextLin...
import java.util.Scanner; class Main { public static void main(String[] args) { int[] sary = new int[6]; String rollpattern; Scanner stdIn = new Scanner(System.in); for (int i = 0; i < sary.length; i++) { sary[i] = stdIn.nextInt(); } stdIn.nextLine(); rollpattern = stdIn.nextLin...
[["-", 0, 195, 8, 196, 0, 1, 0, 11, 12, 22], ["+", 0, 195, 8, 196, 0, 1, 0, 11, 12, 22]]
3
467
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int T = sc.nextInt(); int S = sc.nextInt(); int E = sc.nextInt(); int W = sc.nextInt(); int N = sc.nextInt(); int B = sc.nextInt(); String[] ss = sc.next().split(...
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int T = sc.nextInt(); int S = sc.nextInt(); int E = sc.nextInt(); int W = sc.nextInt(); int N = sc.nextInt(); int B = sc.nextInt(); String[] ss = sc.next().split(...
[["-", 64, 196, 0, 1, 0, 11, 12, 504, 71, 499], ["+", 64, 196, 0, 1, 0, 11, 12, 504, 71, 499]]
3
389
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); Dice dice = new Dice(); for (int i = 1; i <= 6; i++) { dice.putNum(in.nextInt(), i); } dice.top = dice.num1; String str = in.next(); for (int i = 0; i < str.l...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); Dice dice = new Dice(); for (int i = 1; i <= 6; i++) { dice.putNum(in.nextInt(), i); } dice.top = dice.num1; String str = in.next(); for (int i = 0; i < str.l...
[["-", 64, 196, 0, 1, 0, 11, 31, 509, 119, 22], ["+", 64, 196, 0, 1, 0, 11, 31, 509, 119, 22]]
3
551
#include <stdio.h> #include <string.h> int main() { int a[8]; // 6+null 1indexed int i; char str[100]; int v; for (i = 1; i <= 6; i++) { scanf("%d ", &a[i]); //サイコロ } scanf("%s", &str); // str毎にサイコロ動かそ for (i = 0; i < strlen(str); i++) { v = a[1]; // forの中に入れる switch (str[i]) { case '...
#include <stdio.h> #include <string.h> int main() { int a[8]; // 6+null 1indexed int i; char str[100]; int v; for (i = 1; i <= 6; i++) { scanf("%d ", &a[i]); //サイコロ } scanf("%s", &str); // str毎にサイコロ動かそ for (i = 0; i < strlen(str); i++) { v = a[1]; // forの中に入れる switch (str[i]) { case '...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
0
299
#include <stdio.h> #include <string.h> int main(void) { int i, dice[10], x, t = 0, s = 1, e = 2, w = 3, n = 4, b = 5; char dir[110]; for (i = 0; i < 6; i++) { scanf("%d", &dice[i]); } scanf("%s", dir); for (i = 0; i < strlen(dir); i++) { switch (dir[i]) { case 'N': x = t; t = s; ...
#include <stdio.h> #include <string.h> int main(void) { int i, dice[10], x, t = 0, s = 1, e = 2, w = 3, n = 4, b = 5; char dir[110]; for (i = 0; i < 6; i++) { scanf("%d", &dice[i]); } scanf("%s", dir); for (i = 0; i < strlen(dir); i++) { switch (dir[i]) { case 'N': x = t; t = s; ...
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22]]
0
238
#include <stdio.h> #include <string.h> void mD(char C, int *D[]) { switch (C) { int t; case 'N': t = D[0]; D[0] = D[1]; D[1] = D[5]; D[5] = D[4]; D[4] = t; break; case 'S': t = D[0]; D[0] = D[4]; D[4] = D[5]; D[5] = D[1]; D[1] = t; break; case 'E': t = D[...
#include <stdio.h> #include <string.h> void mD(char C, int *D) { switch (C) { int t; case 'N': t = D[0]; D[0] = D[1]; D[1] = D[5]; D[5] = D[4]; D[4] = t; break; case 'S': t = D[0]; D[0] = D[4]; D[4] = D[5]; D[5] = D[1]; D[1] = t; break; case 'E': t = D[0]...
[["-", 54, 55, 0, 56, 49, 84, 49, 80, 0, 70], ["-", 54, 55, 0, 56, 49, 84, 49, 80, 0, 73], ["-", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
0
337
#include <stdio.h> typedef struct { short surf[6]; short top; } dice; int main(void) { dice dice1 = {0, 0}; char command; short trade; register short i; for (i = 0; i < 6; i++) { scanf("%d", &dice1.surf[i]); } while (scanf("%c", &command) != EOF) { switch (command) { case 'E': ...
#include <stdio.h> typedef struct { short surf[6]; short top; } dice; int main(void) { dice dice1 = {0, 0}; char command; short trade; register short i; for (i = 0; i < 6; i++) { scanf("%d", &dice1.surf[i]); } while (scanf("%c", &command) != EOF) { switch (command) { case 'E': ...
[["-", 0, 100, 0, 1, 0, 11, 12, 69, 71, 13], ["+", 0, 100, 0, 1, 0, 11, 12, 69, 71, 13], ["-", 0, 100, 0, 1, 0, 11, 31, 69, 71, 13], ["+", 0, 100, 0, 1, 0, 11, 31, 69, 71, 13]]
0
385
#include <stdio.h> #include <string.h> int main() { int a, i, x[8]; char y[100]; for (i = 0; i < 7; i++) { scanf("%d", &x[i + 1]); } gets(y); a = strlen(y); for (i = 0; i < a; i++) { if (y[i] == 'S') { x[0] = x[1]; x[1] = x[5]; x[5] = x[6]; x[6] = x[2]; x[2] = x[0]; ...
#include <stdio.h> #include <string.h> int main() { int a, i, x[8]; char y[100]; for (i = 0; i < 7; i++) { scanf("%d", &x[i + 1]); } gets(y); a = strlen(y); for (i = 0; i < a; i++) { if (y[i] == 'S') { x[0] = x[1]; x[1] = x[5]; x[5] = x[6]; x[6] = x[2]; x[2] = x[0]; ...
[["-", 0, 57, 15, 23, 0, 16, 12, 103, 0, 125], ["+", 0, 57, 15, 23, 0, 16, 12, 103, 0, 125]]
0
354
#include <stdio.h> int main() { int dice[6]; int temp1, temp2; char move; char kg; scanf("%d %d %d %d %d %d", &dice[0], &dice[1], &dice[2], &dice[3], &dice[4], &dice[5]); scanf("%c", &kg); while (1) { scanf("%c", &move); if (move == '\n') break; if (move == 'N') { temp1 = d...
#include <stdio.h> int main() { int dice[6]; int temp1, temp2; char move; char kg; scanf("%d %d %d %d %d %d", &dice[0], &dice[1], &dice[2], &dice[3], &dice[4], &dice[5]); scanf("%c", &kg); while (1) { scanf("%c", &move); if (move == '\n') break; if (move == 'N') { temp1 = d...
[["-", 64, 9, 0, 1, 0, 11, 31, 69, 71, 13], ["+", 64, 9, 0, 1, 0, 11, 31, 69, 71, 13]]
0
368
#include <stdio.h> #include <string.h> int E[6] = {3, 0, -2, 2, 0, -3}; int W[6] = {2, 0, 3, -3, 0, -2}; int S[6] = {4, -1, 0, 0, 1, -4}; int N[6] = {-1, 4, 0, 0, -4, -1}; void DICE(char a, int d[], int d2[]) { int i; if (a == 'E') { for (i = 0; i < 6; i++) { d2[i] = d[i + E[i]]; } } if (a == '...
#include <stdio.h> #include <string.h> int E[6] = {3, 0, -2, 2, 0, -3}; int W[6] = {2, 0, 3, -3, 0, -2}; int S[6] = {4, -1, 0, 0, 1, -4}; int N[6] = {1, 4, 0, 0, -4, -1}; void DICE(char a, int d[], int d2[]) { int i; if (a == 'E') { for (i = 0; i < 6; i++) { d2[i] = d[i + E[i]]; } } if (a == 'N...
[["-", 0, 30, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 0, 30, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 2, 3, 4, 0, 16, 12, 105, 0, 150], ["+", 0, 2, 3, 4, 0, 16, 12, 105, 0, 24], ["+", 3, 4, 0, 16, 12, 105, 39, 77, 39, 40], ["+", 0, 2, 3, 4, 0, 16, 12, 105, 0, 25]]
0
433
#include <stdio.h> typedef struct dice { int up; int front; int right; int left; int back; int down; } dice; int main(void) { dice sample; char c; int temp; scanf("%d%d%d%d%d%d", &sample.up, &sample.front, &sample.right, &sample.left, &sample.back, &sample.down); while ((c = getchar())...
#include <stdio.h> typedef struct dice { int up; int front; int right; int left; int back; int down; } dice; int main(void) { dice sample; char c; int temp; scanf("%d%d%d%d%d%d", &sample.up, &sample.front, &sample.right, &sample.left, &sample.back, &sample.down); while ((c = getchar())...
[["-", 0, 52, 15, 23, 0, 16, 12, 103, 0, 104], ["-", 0, 52, 15, 23, 0, 16, 12, 103, 0, 44], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22]]
0
298
#include <stdio.h> #define T 1 #define S 2 #define E 3 #define W 4 #define N 5 #define B 6 int main(void) { int dice[7], buf[7]; char hoko[101] = {NULL}; int i, j; for (i = 1; i <= 6; i++) { scanf("%d", &dice[i]); } scanf("%s", hoko); for (i = 0; (int)hoko[i]; i++) { for (j = 1; j <= 6; j++) ...
#include <stdio.h> #define T 1 #define S 2 #define E 3 #define W 4 #define N 5 #define B 6 int main(void) { int dice[7], buf[7]; char hoko[101] = {NULL}; int i, j; for (i = 1; i <= 6; i++) { scanf("%d", &dice[i]); } scanf("%s", hoko); for (i = 0; (int)hoko[i]; i++) { for (j = 1; j <= 6; j++) ...
[["-", 64, 9, 0, 1, 0, 11, 12, 69, 71, 22], ["+", 64, 9, 0, 1, 0, 11, 12, 69, 71, 22]]
0
443
class Dice # 1 # 4 2 3 5 # 6 attr_reader :pips def initialize(*pips) @pips = pips end def rotate_s! pips = [5, 1, 3, 4, 6, 2].map { |i| i - 1 } @pips = @pips.values_at(*pips) self end def rotate_e! pips = [4, 2, 1, 6, 5, 3].map { |i| i - 1 } @pips = @pips.values_at(*pips)...
class Dice # 1 # 4 2 3 5 # 6 attr_reader :pips def initialize(*pips) @pips = pips end def rotate_s! pips = [5, 1, 3, 4, 6, 2].map { |i| i - 1 } @pips = @pips.values_at(*pips) self end def rotate_e! pips = [4, 2, 1, 6, 5, 3].map { |i| i - 1 } @pips = @pips.values_at(*pips)...
[["-", 8, 736, 0, 662, 12, 652, 486, 516, 0, 612], ["-", 8, 736, 0, 662, 12, 652, 486, 516, 0, 21], ["+", 8, 736, 0, 662, 12, 652, 486, 516, 0, 21], ["+", 8, 736, 0, 662, 12, 652, 486, 516, 0, 612]]
4
225
class Dice attr_accessor :faces #メンバ変数を外部から参照可能に dice.faces def initialize(arr) @faces = arr end def roll(direction) case direction when "N" tmp = @faces[0] @faces[0] = @faces[1] @faces[1] = @faces[5] @faces[4] = @faces[5] @faces[5] = tmp when "S" tmp = @face...
class Dice attr_accessor :faces #メンバ変数を外部から参照可能に dice.faces def initialize(arr) @faces = arr end def roll(direction) case direction when "N" tmp = @faces[0] @faces[0] = @faces[1] @faces[1] = @faces[5] @faces[5] = @faces[4] @faces[4] = tmp when "S" tmp = @face...
[["-", 0, 763, 8, 749, 0, 662, 31, 742, 0, 612], ["+", 0, 763, 8, 749, 0, 662, 31, 742, 0, 612], ["-", 0, 763, 8, 749, 0, 662, 12, 742, 0, 612], ["+", 0, 763, 8, 749, 0, 662, 12, 742, 0, 612]]
4
250
class Dice def initialize() # top bottom N E S W @dice_number = [1, 6, 5, 3, 2, 4] end def throw(command) swap_number = [] case command when 'N' swap_number = [2, 1, 4] swap(swap_number) when 'E' swap_number = [3, 1, 5] swap(swap_number) when 'S' swap_number = [4, 1, 2] swap(swap_nu...
class Dice def initialize() # top bottom N E S W @dice_number = [1, 6, 5, 3, 2, 4] end def throw(command) swap_number = [] case command when 'N' swap_number = [2, 1, 4] swap(swap_number) when 'E' swap_number = [3, 1, 5] swap(swap_number) when 'S' swap_number = [4, 1, 2] swap(swap_nu...
[["-", 0, 763, 8, 749, 0, 662, 12, 516, 0, 612], ["+", 0, 763, 8, 749, 0, 662, 12, 516, 0, 612]]
4
195
dice = STDIN.gets.chomp().split(" ") line = STDIN.gets.chomp() roll = Array.new(line.length) { |i| i = line[i, 1]} p dice p roll for i in 0..roll.length - 1 do case roll[i] when "S" then temp = dice[0] dice[0] = dice[4] dice[4] = dice[5] dice[5] = dice[1] dice[1] = temp when "N" then te...
dice = STDIN.gets.chomp().split(" ") line = STDIN.gets.chomp() roll = Array.new(line.length) { |i| i = line[i, 1]} for i in 0..roll.length - 1 do case roll[i] when "S" then temp = dice[0] dice[0] = dice[4] dice[4] = dice[5] dice[5] = dice[1] dice[1] = temp when "N" then temp = dice[0] ...
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
251
$stdin = DATA class Dice def initialize dice = gets.split.map(&:to_i) @action = gets.chomp @upper = dice[0] @side = [ dice[4], dice[2], dice[1], dice[3] ] @bottom = dice[5] end def print_upper @action.chars do |str| b = @bottom u = @upper case str when "N" ...
class Dice def initialize dice = gets.split.map(&:to_i) @action = gets.chomp @upper = dice[0] @side = [ dice[4], dice[2], dice[1], dice[3] ] @bottom = dice[5] end def print_upper @action.chars do |str| b = @bottom u = @upper case str when "N" @upper ...
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 744], ["-", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["-", 36, 36, 36, 36, 0, 493, 0, 662, 12, 743]]
4
202
class Dice attr_reader :upper_number def initialize(numbers) @numbers = numbers.unshift 0 @upper_number = numbers[0] end def rotate(instruction) instruction.split('').each{|op| case op when 'W' tmp = @numbers[1] @numbers[1]=@numbers[3]; @numbers[3]=@numbers[6]; @numbers[6]=@numbers[4]; @number...
class Dice attr_reader :upper_number def initialize(numbers) @numbers = numbers.unshift 0 @upper_number = numbers[0] end def rotate(instruction) instruction.split('').each{|op| case op when 'W' tmp = @numbers[1] @numbers[1]=@numbers[3]; @numbers[3]=@numbers[6]; @numbers[6]=@numbers[4]; @number...
[["-", 0, 735, 8, 736, 0, 662, 12, 742, 500, 22], ["+", 0, 735, 8, 736, 0, 662, 12, 742, 500, 777], ["-", 0, 735, 8, 736, 0, 662, 12, 742, 0, 612], ["+", 0, 735, 8, 736, 0, 662, 12, 742, 0, 612]]
4
268
class Dice def initialize(*lbl) @lbl = lbl end def W Dice.new(*[2,1,5,0,4,3].map{|x| @lbl[x]}) end def E Dice.new(*[3,1,0,5,4,2].map{|x| @lbl[x]}) end def N Dice.new(*[1,5,2,3,0,4].map{|x| @lbl[x]}) end def S Dice.new(*[4,0,2,3,5,1].map{|x| @lbl[x]}) end [:top, :front, :right...
class Dice def initialize(*lbl) @lbl = lbl end def W Dice.new(*[2,1,5,0,4,3].map{|x| @lbl[x]}) end def E Dice.new(*[3,1,0,5,4,2].map{|x| @lbl[x]}) end def N Dice.new(*[1,5,2,3,0,4].map{|x| @lbl[x]}) end def S Dice.new(*[4,0,2,3,5,1].map{|x| @lbl[x]}) end [:top, :front, :right...
[["-", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 736, 0, 652, 3, 4, 0, 557, 0, 6]]
4
209
class Dice def initialize (given_ary) @ary = given_ary end def roll (direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] =tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @ar...
class Dice def initialize (given_ary) @ary = given_ary end def roll (direction) case direction.downcase when "e" tmp = @ary[0] @ary[0] = @ary[3] @ary[3] = @ary[5] @ary[5] = @ary[2] @ary[2] = tmp when "w" tmp = @ary[0] @ary[0] = @ary[2] @ary[2] = @a...
[["-", 0, 652, 486, 652, 3, 4, 0, 557, 0, 62], ["-", 0, 652, 486, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 652, 486, 652, 3, 4, 0, 557, 0, 62]]
4
243
class Dice attr_reader :surface def initialize arr @surface = arr end def rotate d tmp = @surface.clone case d when 'N' tmp[0]=@surface[1];tmp[1]=@surface[5];tmp[5]=@surface[4];tmp[4]=@surface[0] when 'S' tmp[0]=@surface[4];tmp[1]=@surface[0];tmp[5]=@surface[1];tmp[4]=@surface[5] when 'W' tmp[3...
class Dice attr_reader :surface def initialize arr @surface = arr end def rotate d tmp = @surface.clone case d when 'N' tmp[0]=@surface[1];tmp[1]=@surface[5];tmp[5]=@surface[4];tmp[4]=@surface[0] when 'S' tmp[0]=@surface[4];tmp[1]=@surface[0];tmp[5]=@surface[1];tmp[4]=@surface[5] when 'W' tmp[3...
[["-", 0, 763, 8, 749, 0, 662, 12, 742, 0, 612], ["+", 0, 763, 8, 749, 0, 662, 12, 742, 0, 612], ["-", 0, 763, 8, 749, 0, 662, 31, 742, 0, 612], ["+", 0, 763, 8, 749, 0, 662, 31, 742, 0, 612]]
4
226
class Dice def initialize(faces) @top = faces.shift @back = faces.shift @right = faces.shift @left = faces.shift @front = faces.shift @bottom = faces.shift end def turn_to_n old_top = @top @top = @front @front = @bottom @bottom = @back @back = old_top end def turn...
class Dice def initialize(faces) @top = faces.shift @front = faces.shift @right = faces.shift @left = faces.shift @back = faces.shift @bottom = faces.shift end def turn_to_n old_top = @top @top = @front @front = @bottom @bottom = @back @back = old_top end def turn...
[["-", 8, 736, 0, 735, 8, 736, 0, 662, 31, 777], ["+", 8, 736, 0, 735, 8, 736, 0, 662, 31, 777]]
4
195
surface = gets.split.map(&:to_i) commands = gets.chomp.char.map(&:to_sym) throw = {E: [3, 2, 6, 1, 5, 4], N: [5, 1, 3, 4, 6, 2], S: [2, 6, 3, 4, 1, 5], W: [4, 2, 1, 6, 5, 3]} th = {} throw.each_key {|k| th[k] = throw[k].map(&:pred)} dice = [*0..5] commands.each do |c| next_dice = Array.new(6, 0) dice.each...
surface = gets.split.map(&:to_i) commands = gets.chomp.chars.map(&:to_sym) throw = {E: [3, 2, 6, 1, 5, 4], N: [5, 1, 3, 4, 6, 2], S: [2, 6, 3, 4, 1, 5], W: [4, 2, 1, 6, 5, 3]} th = {} throw.each_key do |k| th[k] = throw[k].map(&:pred) end dice = [*0..5] commands.each do |c| next_dice = Array.new(6, 0) d...
[["-", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["+", 0, 493, 0, 662, 12, 652, 486, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 196, 196, 0, 45], ["+", 36, 36, 0, 493, 0, 652, 196, 737, 0, 170], ["-", 36, 36, 0, 493, 0, 652, 196, 196, 0, 46], ["+", 36, 36, 0, 493, 0, 652, 196, 737, 0, 444]]
4
177
class Daise: def __init__(self, info_list): self.T = info_list[0] self.S = info_list[1] self.N = info_list[2] self.W = info_list[3] self.E = info_list[4] self.B = info_list[5] def change(self, axis): if axis == 'S': self.T, self.B, self.S,...
class Daise: def __init__(self, info_list): self.T = info_list[0] self.S = info_list[1] self.E = info_list[2] self.W = info_list[3] self.N = info_list[4] self.B = info_list[5] def change(self, axis): if axis == 'S': self.T, self.B, self.S,...
[["-", 8, 196, 0, 1, 0, 662, 31, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 319, 319, 22]]
5
274
import copy class Dice: def __init__(self, eyes): self._top = eyes[0] self._front = eyes[1] self._right = eyes[2] self._left = eyes[3] self._back = eyes[4] self._bottom = eyes[5] @property def eye(self): return self._top def roll(self, directio...
import copy class Dice: def __init__(self, eyes): self._top = eyes[0] self._front = eyes[1] self._right = eyes[2] self._left = eyes[3] self._back = eyes[4] self._bottom = eyes[5] @property def eye(self): return self._top def roll(self, directio...
[["-", 64, 196, 0, 1, 0, 662, 12, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 319, 319, 22], ["-", 64, 196, 0, 1, 0, 662, 31, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 319, 319, 22]]
5
275
class Dice(object): def __init__(self, top, south, east, west, north, bottom): self.top = top self.south = south self.east = east self.west = west self.north = north self.bottom = bottom def rollN(self): prevN = self.north prevB = self.bottom ...
class Dice(object): def __init__(self, top, south, east, west, north, bottom): self.top = top self.south = south self.east = east self.west = west self.north = north self.bottom = bottom def rollN(self): prevN = self.north prevB = self.bottom ...
[["+", 8, 196, 0, 1, 0, 662, 12, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 319, 0, 131]]
5
343
class Dice: def __init__(self, data): self.data = data def move(self, direction): if direction == 'E': self.data[0],self.data[3], self.data[5], self.data[2] = \ self.data[3],self.data[5], self.data[2], self.data[0] elif direction == 'N': self.dat...
class Dice: def __init__(self, data): self.data = data def move(self, direction): if direction == 'E': self.data[0],self.data[3], self.data[5], self.data[2] = \ self.data[3],self.data[5], self.data[2], self.data[0] elif direction == 'N': self.dat...
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22]]
5
336
# 1: top, 2: front, 3: right, # 4: left, 5: back, 6: bottom class Dice: def __init__(self, nums): self.top, self.front, self.right, self.left, self.back, self.bottom = nums def roll(self, direction): if direction == 'E': self.top, self.right, self.left, self.bottom = self.left, sel...
# 1: top, 2: front, 3: right, # 4: left, 5: back, 6: bottom class Dice: def __init__(self, nums): self.top, self.front, self.right, self.left, self.back, self.bottom = nums def roll(self, direction): if direction == 'E': self.top, self.right, self.left, self.bottom = self.left, sel...
[["+", 0, 57, 64, 196, 0, 7, 12, 652, 63, 22], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
273
import sys data=list(map(int,input().split())) order=sys.stdin.readline() char_list=list(order) for i in char_list: if i=='N': k=data[1] m=data[5] data[0]=data[1] data[1]=data[5] data[4]=k data[5]=m elif i=='E': k=data[0] m=data[2] data[0]=data[3] data[2]=k data[3]=data[5] data[5]=m elif i...
import sys data=list(map(int,input().split())) order=sys.stdin.readline() char_list=list(order) for i in char_list: if i=='N': k=data[0] m=data[4] data[0]=data[1] data[1]=data[5] data[4]=k data[5]=m elif i=='E': k=data[0] m=data[2] data[0]=data[3] data[2]=k data[3]=data[5] data[5]=m elif i...
[["-", 64, 196, 0, 1, 0, 662, 12, 206, 206, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 206, 206, 612]]
5
242
class Dice: def __init__(self, faces): self.faces = tuple(faces) def roll_north(self): self.faces = (self.faces[1], self.faces[5], self.faces[2], self.faces[3], self.faces[0], self.faces[4]) def roll_south(self): self.faces = (self.faces[4], self.faces[0], se...
class Dice: def __init__(self, faces): self.faces = tuple(faces) def roll_north(self): self.faces = (self.faces[1], self.faces[5], self.faces[2], self.faces[3], self.faces[0], self.faces[4]) def roll_south(self): self.faces = (self.faces[4], self.faces[0], se...
[["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
333
m={"E":[3,1,0,5,4,2], "N":[1,5,2,3,0,4], "W":[2,1,5,0,4,3], "S":[4,0,2,3,5,1]} d=list(map(int, input().split())) nd=[0]*6 dir=input() for i in range(len(dir)): x=dir[i] for j in range(6): nd[j]=d[m[x][j]] d=nd print(d[0])
m={"E":[3,1,0,5,4,2], "N":[1,5,2,3,0,4], "W":[2,1,5,0,4,3], "S":[4,0,2,3,5,1]} d=list(map(int, input().split())) nd=[0]*6 dir=input() for i in range(len(dir)): x=dir[i] for j in range(6): nd[j]=d[m[x][j]] d=list(nd) print(d[0])
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
154
class Dice: def __init__(self,n,e,s,w,u,d): self.n = n self.e = e self.s = s self.w = w self.u = u self.d = d def roll(self,dir): if (dir == "N"): tmp = self.n self.n = self.u self.u = self.s self.s = self.d ...
class Dice: def __init__(self,u,s,e,w,n,d): self.n = n self.e = e self.s = s self.w = w self.u = u self.d = d def roll(self,dir): if (dir == "N"): tmp = self.n self.n = self.u self.u = self.s self.s = self.d ...
[["-", 0, 682, 8, 196, 0, 14, 54, 54, 0, 22], ["-", 0, 682, 8, 196, 0, 14, 54, 54, 0, 21], ["+", 0, 682, 8, 196, 0, 14, 54, 54, 0, 22], ["+", 0, 682, 8, 196, 0, 14, 54, 54, 0, 21]]
5
257
class Dice : def __init__(self,num): self.num = num def move_E(self): self.copy = self.num.copy() for i,j in zip([0,2,5,3],[3,0,2,5]): self.num[i] = self.copy[j] def move_W(self): self.copy = self.num.copy() for i,j in zip([0,3,5,2],[2,0,3,5]): ...
class Dice : def __init__(self,num): self.num = num def move_E(self): self.copy = self.num.copy() for i,j in zip([0,2,5,3],[3,0,2,5]): self.num[i] = self.copy[j] def move_W(self): self.copy = self.num.copy() for i,j in zip([0,3,5,2],[2,0,3,5]): ...
[["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 25], ["-", 0, 1, 0, 652, 3, 4, 0, 23, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 23, 0, 25]]
5
340
class Dice: def __init__(self): self.numbers = list(map(int, input().split())) def roll(self, direction): if direction == "N": before_inds = [0, 1, 5, 4] after_inds = [1, 5, 4, 0] elif direction == "S": before_inds = [0, 1, 5, 4] ...
class Dice: def __init__(self): self.numbers = list(map(int, input().split())) def roll(self, direction): if direction == "N": before_inds = [0, 1, 5, 4] after_inds = [1, 5, 4, 0] elif direction == "S": before_inds = [0, 1, 5, 4] ...
[["-", 0, 57, 75, 665, 15, 666, 0, 557, 0, 6], ["+", 0, 57, 75, 665, 15, 666, 0, 557, 0, 6]]
5
220
class Dice(object): def __init__(self): self.upside = 1 self.frontside = 2 self.rightside = 3 self.backside = 4 self.leftside = 5 self.downside = 6 def throwDice(self,dir): up = self.upside front = self.frontside left = self.leftside ...
class Dice(object): def __init__(self): self.upside = 1 self.frontside = 2 self.rightside = 3 self.backside = 5 self.leftside = 4 self.downside = 6 def throwDice(self,dir): up = self.upside front = self.frontside left = self.leftside ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612]]
5
262
d=list(map(int,input().split())) c=list(input()) class dice(object): def __init__(self, d): self.d = d def roll(self,com): a1,a2,a3,a4,a5,a6=self.d if com=="E": self.d = [a4,a2,a1,a6,a5,a3] elif com=="W": self.d = [a3,a2,a6,a1,a5,a4] elif com=="S": self.d = [a5,a1,a3,a4,a6,a2] elif com=="N": ...
d=list(map(int,input().split())) c=list(input()) class dice(object): def __init__(self, d): self.d = d def roll(self,com): a1,a2,a3,a4,a5,a6=self.d if com=="E": self.d = [a4,a2,a1,a6,a5,a3] elif com=="W": self.d = [a3,a2,a6,a1,a5,a4] elif com=="S": self.d = [a5,a1,a3,a4,a6,a2] elif com=="N": ...
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131]]
5
187
dice = [1,2,3,4,5,6] number = list(map(int,input().split())) direction = str(input()) rotate_n =[2,6,4,3,1,5] rotate_s =[5,1,3,4,6,2] rotate_e =[4,2,1,6,5,3] rotate_w =[3,2,6,1,5,4] for i in direction: result = [] if i == "N": for j in range(6): dice[j] = rotate_n[j] elif i == "S": ...
dice = [1,2,3,4,5,6] number = list(map(int,input().split())) direction = str(input()) rotate_n =[2,6,3,4,1,5] rotate_s =[5,1,3,4,6,2] rotate_e =[4,2,1,6,5,3] rotate_w =[3,2,6,1,5,4] for i in direction: result = [] if i == "N": for j in range(6): dice[j] = rotate_n[j] elif i == "S": ...
[["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 21], ["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 21], ["+", 0, 656, 0, 1, 0, 662, 12, 634, 0, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612]]
5
226
# coding: utf-8 # Here your code ! import sys import collections import unittest def top_face_after_rolling_dice(): try: faces = [int(num) for num in input().rstrip().split()] rollings = input().rstrip() except: return __input_error() dice = CubicArbitraryValueDice(faces[0], fac...
# coding: utf-8 # Here your code ! import sys import collections import unittest def top_face_after_rolling_dice(): try: faces = [int(num) for num in input().rstrip().split()] rollings = input().rstrip() except: return __input_error() dice = CubicArbitraryValueDice(faces[0], fac...
[["-", 8, 196, 0, 14, 54, 54, 0, 696, 0, 32], ["-", 0, 14, 54, 54, 0, 696, 51, 319, 500, 22], ["-", 0, 14, 54, 54, 0, 696, 51, 319, 0, 131], ["-", 0, 14, 54, 54, 0, 696, 51, 319, 319, 22], ["-", 8, 196, 0, 14, 54, 54, 0, 696, 51, 147]]
5
503
u, s, e, w, n, d = list(map(int, input().split())) insts = eval(input()) for inst in insts: if inst == 'N': u, s, n, d = s, d, u, n elif inst == 'E': u, e, w, d = w, u, d, e elif inst == 'S': u, s, n, d = n, u, d, s elif inst == 'W': u, e, w, d = e, d, u, w print(u)
u, s, e, w, n, d = list(map(int, input().split())) insts = input() for inst in insts: if inst == 'N': u, s, n, d = s, d, u, n elif inst == 'E': u, e, w, d = w, u, d, e elif inst == 'S': u, s, n, d = n, u, d, s elif inst == 'W': u, e, w, d = e, d, u, w print(u)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
132
u, s, e, w, n, d = list(map(int, input().split())) insts = eval(input()) for inst in insts: if inst == 'N': u, s, n, d = s, d, u, n elif inst == 'E': u, e, w, d = w, u, d, e elif inst == 'S': u, s, n, d = n, u, d, s elif inst == 'W': u, e, w, d = e, d, u, w print(u)
u, s, e, w, n, d = map(int, input().split()) insts = input() for inst in insts: if inst == 'N': u, s, n, d = s, d, u, n elif inst == 'E': u, e, w, d = w, u, d, e elif inst == 'S': u, s, n, d = n, u, d, s elif inst == 'W': u, e, w, d = e, d, u, w print(u)
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
132
#N E S W def move_func(dice_list, dir): new_dice = [] if dir=="N": new_dice.append(dice_list[1]) new_dice.append(dice_list[5]) new_dice.append(dice_list[2]) new_dice.append(dice_list[3]) new_dice.append(dice_list[0]) new_dice.append(dice_list[4]) elif dir=="E": new_dice.append(dice_list[3]) new_dice....
#N E S W def move_func(dice_list, dir): new_dice = [] if dir=="N": new_dice.append(dice_list[1]) new_dice.append(dice_list[5]) new_dice.append(dice_list[2]) new_dice.append(dice_list[3]) new_dice.append(dice_list[0]) new_dice.append(dice_list[4]) elif dir=="E": new_dice.append(dice_list[3]) new_dice....
[["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612]]
5
305
class Dice(): def __init__(self, *n): self.rolls = n def spin(self, order): if order == "N": self.rolls = [ self.rolls[1], self.rolls[5], self.rolls[2], self.rolls[3], self.rolls[4], self...
class Dice(): def __init__(self, *n): self.rolls = n def spin(self, order): if order == "N": self.rolls = [ self.rolls[1], self.rolls[5], self.rolls[2], self.rolls[3], self.rolls[0], self...
[["-", 0, 1, 0, 662, 12, 634, 0, 206, 206, 612], ["+", 0, 1, 0, 662, 12, 634, 0, 206, 206, 612]]
5
294
a, b, c, d, e, f = map(int, input().split()) S = list(input()) i = 0 number1 = a number2 = b number3 = c number4 = d number5 = e number6 = f while i < len(S) : if S[i] == "N" : number1 = b number2 = f number3 = c number4 = d number5 = a number6 = e elif S[i] == "...
a, b, c, d, e, f = map(int, input().split()) S = list(input()) i = 0 number1 = a number2 = b number3 = c number4 = d number5 = e number6 = f while i < len(S) : if S[i] == "N" : number1 = b number2 = f number3 = c number4 = d number5 = a number6 = e elif S[i] == "...
[["-", 75, 665, 64, 196, 0, 1, 0, 662, 12, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 12, 22]]
5
200
from collections import deque class Dice: def __init__(self, top, down, right, left, up, bottom): self.top = top self.bottom = bottom self.up = up self.down = down self.left = left self.right = right def roll(self, command): for c in list(command): ...
from collections import deque class Dice: def __init__(self, top, down, right, left, up, bottom): self.top = top self.bottom = bottom self.up = up self.down = down self.left = left self.right = right def roll(self, command): for c in list(command): ...
[["-", 64, 196, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 0, 1, 0, 662, 31, 684, 0, 319, 0, 131]]
5
280
def dice(): dice = list(map(str, input().split())) direction = input() for i in range(len(direction)): if direction[i] == "N": dice[0],dice[1],dice[4],dice[5] = dice[1],dice[5],dice[0],dice[4] elif direction[i] == "S": dice[0],dice[1],dice[4],dice[5] = dice[4],dice[0],dice[5],dice[1] elif direction[i] ==...
dice = list(map(str, input().split())) direction = input() for i in range(len(direction)): if direction[i] == "N": dice[0],dice[1],dice[4],dice[5] = dice[1],dice[5],dice[0],dice[4] elif direction[i] == "S": dice[0],dice[1],dice[4],dice[5] = dice[4],dice[0],dice[5],dice[1] elif direction[i] == "W": dice[0],dice...
[["-", 36, 36, 36, 36, 0, 656, 0, 14, 0, 669], ["-", 36, 36, 0, 656, 0, 14, 54, 54, 0, 24], ["-", 36, 36, 0, 656, 0, 14, 54, 54, 0, 25], ["-", 36, 36, 36, 36, 0, 656, 0, 14, 0, 102], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22]]
5
233
l = list(map(int, input().split())) s = input() for c in s: if c == "S": l = [l[4], l[0], l[2], l[3], l[1], l[5]] elif c == "N": l = [l[1], l[5], l[2], l[3], l[4], l[0]] elif c == "E": l = [l[3], l[1], l[0], l[5], l[4], l[2]] else: l = [l[2], l[1], l[5], l[0], l[4], l[3]] print(l[0])
l = list(map(int, input().split())) s = input() for c in s: if c == "S": l = [l[4], l[0], l[2], l[3], l[5], l[1]] elif c == "N": l = [l[1], l[5], l[2], l[3], l[0], l[4]] elif c == "E": l = [l[3], l[1], l[0], l[5], l[4], l[2]] else: l = [l[2], l[1], l[5], l[0], l[4], l[3]] print(l[0])
[["-", 0, 1, 0, 662, 12, 634, 0, 206, 206, 612], ["+", 0, 1, 0, 662, 12, 634, 0, 206, 206, 612]]
5
189
class Dice: def __init__(self,t,f,r,l,b,u): self.t=t self.f=f self.r=r self.l=l self.b=b self.u=u def roll(self,i): if d=='S': key=self.t self.t=self.b self.b=self.u self.u=self.f self.t=key ...
class Dice: def __init__(self,t,f,r,l,b,u): self.t=t self.f=f self.r=r self.l=l self.b=b self.u=u def roll(self,i): if d=='S': key=self.t self.t=self.b self.b=self.u self.u=self.f self.f=key ...
[["-", 64, 196, 0, 1, 0, 662, 31, 319, 319, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 319, 319, 22]]
5
271
class Dice(): def __init__(self, numbers): self.top = numbers[0] self.s = numbers[1] self.e = numbers[2] self.w = numbers[3] self.n = numbers[4] self.bot = numbers[5] def rot(self, dir): top, s, e, w, n, bot = (self.top, self.s, self.e, self.w, self.b, sel...
class Dice(): def __init__(self, numbers): self.top = numbers[0] self.s = numbers[1] self.e = numbers[2] self.w = numbers[3] self.n = numbers[4] self.bot = numbers[5] def rot(self, dir): top, s, e, w, n, bot = (self.top, self.s, self.e, self.w, self.n, sel...
[["-", 0, 1, 0, 662, 12, 660, 0, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 660, 0, 319, 319, 22]]
5
311
class Dice: def __init__(self, val): self.top = val[0] self.flat1 = val[3] self.flat2 = val[1] self.flat3 = val[2] self.flat4 = val[4] self.bottom = val[5] def doSouth(self): temp = self.bottom self.bottom = self.flat2 self.fl...
class Dice: def __init__(self, val): self.top = val[0] self.flat1 = val[3] self.flat2 = val[1] self.flat3 = val[2] self.flat4 = val[4] self.bottom = val[5] def doSouth(self): temp = self.bottom self.bottom = self.flat2 self.fl...
[["-", 8, 196, 0, 1, 0, 662, 31, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 662, 31, 319, 319, 22]]
5
346
function Dice(labels) { this.top = labels[0]; this.back = labels[1]; this.right = labels[2]; this.left = labels[3]; this.front = labels[4]; this.bottom = labels[5]; }; Dice.prototype.roll = function(direction) { switch (direction) { case 'W': var tmp = this.left; this.left = this.top; this....
function Dice(labels) { this.top = labels[0]; this.back = labels[1]; this.right = labels[2]; this.left = labels[3]; this.front = labels[4]; this.bottom = labels[5]; }; Dice.prototype.roll = function(direction) { switch (direction) { case 'W': var tmp = this.left; this.left = this.top; this....
[["-", 0, 57, 64, 556, 0, 37, 0, 558, 559, 560], ["+", 0, 57, 64, 556, 0, 37, 0, 558, 559, 560]]
2
933
#!/usr/bin/env ruby result = [] dice = gets.split.map(&:to_i) loop_number = gets.to_i loop_number.times do |index| face = gets.split.map(&:to_i) case face[0] when dice[0] then case face[1] when dice[1] then result << dice[2] when dice[2] then result << dice[4...
#!/usr/bin/env ruby result = [] dice = gets.split.map(&:to_i) loop_number = gets.to_i loop_number.times do |index| face = gets.split.map(&:to_i) case face[0] when dice[0] then case face[1] when dice[1] then result << dice[2] when dice[2] then result << dice[4...
[["-", 0, 763, 8, 749, 0, 738, 12, 742, 0, 612], ["+", 0, 763, 8, 749, 0, 738, 12, 742, 0, 612]]
4
438
class Dice TOP=0 FRONT=1 RIGHT=2 LEFT=3 BACK=4 BOTTOM=5 def initialize( nums ) @face = nums end def rolltoTop( num ) from = 0 for i in ( 0 ... @face.length ) if num == @face[i] from = i break end end case from when FRONT roll( "N" ) when RIGHT roll( "W" ) when LEFT ro...
class Dice TOP=0 FRONT=1 RIGHT=2 LEFT=3 BACK=4 BOTTOM=5 def initialize( nums ) @face = nums end def rolltoTop( num ) from = 0 for i in ( 0 ... @face.length ) if num == @face[i] from = i break end end case from when FRONT roll( "N" ) when RIGHT roll( "W" ) when LEFT ro...
[["-", 8, 749, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 8, 749, 0, 652, 3, 4, 0, 557, 0, 6]]
4
447
#!/usr/bin/env ruby # vim:set fileencoding=utf-8: class Dice def initialize( given_ary ) @ary = given_ary end def topface( val ) 4.times do self.roll( "E" ) if self.top == val return end end 2.times do self.roll( "N" ) if self.top == val return ...
#!/usr/bin/env ruby # vim:set fileencoding=utf-8: class Dice def initialize( given_ary ) @ary = given_ary end def topface( val ) 4.times do self.roll( "E" ) if self.top == val return end end 3.times do self.roll( "N" ) if self.top == val return ...
[["-", 8, 736, 0, 735, 8, 736, 0, 652, 486, 612], ["+", 8, 736, 0, 735, 8, 736, 0, 652, 486, 612]]
4
377
class Dice @numbers = [] def initialize numbers @numbers = numbers end def roll direction old = @numbers.dup case direction when "N" @numbers[0] = old[1] @numbers[1] = old[5] @numbers[5] = old[4] @numbers[4] = old[0] ...
class Dice @numbers = [] def initialize numbers @numbers = numbers end def roll direction old = @numbers.dup case direction when "N" @numbers[0] = old[1] @numbers[1] = old[5] @numbers[5] = old[4] @numbers[4] = old[0] ...
[["-", 0, 173, 0, 763, 8, 749, 0, 652, 735, 22], ["+", 0, 173, 0, 763, 8, 749, 0, 652, 735, 22]]
4
424
<?php $input = trim(fgets(STDIN)); $numbers = explode(" ", $input); $dice = new Dice($numbers); $n = trim(fgets(STDIN)); do { $input = trim(fgets(STDIN)); List($t, $f) = explode(" ", $input); $td = $dice->getDirection($t); switch ($td) { case "B": $dice->roll("NN"); break; case "S": $dice->roll("N"); b...
<?php $input = trim(fgets(STDIN)); $numbers = explode(" ", $input); $dice = new Dice($numbers); $n = trim(fgets(STDIN)); do { $input = trim(fgets(STDIN)); List($t, $f) = explode(" ", $input); $td = $dice->getDirection($t); switch ($td) { case "B": $dice->roll("NN"); break; case "S": $dice->roll("N"); b...
[["-", 0, 99, 8, 527, 0, 100, 51, 609, 0, 610], ["+", 0, 99, 8, 527, 0, 100, 51, 609, 0, 610], ["-", 0, 623, 3, 3, 0, 28, 0, 609, 0, 610], ["+", 0, 623, 3, 3, 0, 28, 0, 609, 0, 610]]
6
575
public class Main { public void run(java.io.InputStream in, java.io.PrintStream out) { java.util.Scanner sc = new java.util.Scanner(in); int[] d = new int[6]; int i, q, a, b; for (i = 0; i < 6; i++) d[i] = sc.nextInt(); for (q = sc.nextInt(); q-- > 0; out.println(solve(d, a, b))) { a =...
public class Main { public void run(java.io.InputStream in, java.io.PrintStream out) { java.util.Scanner sc = new java.util.Scanner(in); int[] d = new int[6]; int i, q, a, b; for (i = 0; i < 6; i++) d[i] = sc.nextInt(); for (q = sc.nextInt(); q-- > 0; out.println(solve(d, a, b))) { a =...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499]]
3
480
import java.util.Scanner; public class Main { public static Scanner sc; public static void main(String[] args) { sc = new Scanner(System.in); Dice2 dice = new Dice2(); for (int i = 0; i < 6; i++) { dice.set(sc.nextInt(), i); } int q = sc.nextInt(); for (int i = 0; i < q; i++) { ...
import java.util.Scanner; public class Main { public static Scanner sc; public static void main(String[] args) { sc = new Scanner(System.in); Dice2 dice = new Dice2(); for (int i = 0; i < 6; i++) { dice.set(sc.nextInt(), i); } int q = sc.nextInt(); for (int i = 0; i < q; i++) { ...
[["-", 0, 492, 3, 4, 0, 492, 3, 4, 0, 499], ["+", 0, 492, 3, 4, 0, 492, 3, 4, 0, 499]]
3
538
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.LinkedList; import java.util.List; class Main { public static void main(String[] args) throws IOException { List<Integer> tatelist = new LinkedList<>(Arrays.asList(1, 2, 6, 5))...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.LinkedList; import java.util.List; class Main { public static void main(String[] args) throws IOException { List<Integer> tatelist = new LinkedList<>(Arrays.asList(1, 2, 6, 5))...
[["-", 0, 492, 3, 4, 0, 16, 31, 16, 17, 33], ["-", 0, 492, 3, 4, 0, 16, 31, 16, 12, 499]]
3
1,440
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] dice_num, dice_num0; dice_num = new int[10]; dice_num0 = new int[10]; int[] dice_s; dice_s = new int[10]; int i, m; for (i = 0; i < 6; i++) dice_num...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] dice_num, dice_num0; dice_num = new int[10]; dice_num0 = new int[10]; int[] dice_s; dice_s = new int[10]; int i, m; for (i = 0; i < 6; i++) { dice_n...
[["+", 0, 195, 8, 196, 0, 7, 8, 196, 0, 45], ["+", 0, 195, 8, 196, 0, 7, 8, 196, 0, 46], ["-", 0, 57, 15, 15, 0, 16, 31, 504, 71, 499], ["+", 0, 57, 15, 15, 0, 16, 31, 504, 71, 499], ["-", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 12, 22]]
3
661
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] num = new int[6]; for (int i = 0; i < 6; i++) { num[i] = sc.nextInt(); } Dice1 d = new Dice1(num); int q = sc.nextInt(); int un = 0, fn = 0; for (int...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] num = new int[6]; for (int i = 0; i < 6; i++) { num[i] = sc.nextInt(); } Dice1 d = new Dice1(num); int q = sc.nextInt(); int un = 0, fn = 0; for (int...
[["-", 0, 57, 75, 57, 15, 15, 0, 16, 12, 499], ["+", 0, 57, 75, 57, 15, 15, 0, 16, 12, 499], ["-", 75, 57, 75, 57, 15, 15, 0, 16, 12, 499], ["+", 75, 57, 75, 57, 15, 15, 0, 16, 12, 499]]
3
648
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; public class Main { public static void main(String[] args) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String x = ""; try { x = in.readLine(); ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; public class Main { public static void main(String[] args) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String x = ""; try { x = in.readLine(); ...
[["-", 0, 526, 8, 527, 0, 520, 0, 528, 0, 499], ["+", 0, 526, 8, 527, 0, 520, 0, 528, 0, 499]]
3
624
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { // TODO ????????????????????????????????????????????? InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); ...
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { // TODO ????????????????????????????????????????????? InputStreamReader isr = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isr); ...
[["+", 8, 196, 0, 7, 8, 196, 0, 97, 0, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 97, 0, 102], ["+", 0, 57, 64, 196, 0, 57, 64, 93, 0, 22]]
3
651
import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] arsg) throws IOException { Scanner scan = new Scanner(System.in); int[] x = new int[6]; for (int i = 0; i < 6; i++) { x[i] = scan.nextInt(); } int y = scan.nextInt(); for (int i = 0; i < ...
import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] arsg) throws IOException { Scanner scan = new Scanner(System.in); int[] x = new int[6]; for (int i = 0; i < 6; i++) { x[i] = scan.nextInt(); } int y = scan.nextInt(); for (int i = 0; i < ...
[["-", 31, 16, 12, 16, 12, 16, 12, 504, 71, 499], ["+", 31, 16, 12, 16, 12, 16, 12, 504, 71, 499]]
3
562
import java.util.Scanner; public class Main { private static Scanner sc = new Scanner(System.in); private static int[] a = new int[6]; private static int questionLength; public static void main(String[] args) { for (int i = 0; i < a.length; i++) { a[i] = sc.nextInt(); } questionLength = sc.ne...
import java.util.Scanner; public class Main { private static Scanner sc = new Scanner(System.in); private static int[] a = new int[6]; private static int questionLength; public static void main(String[] args) { for (int i = 0; i < a.length; i++) { a[i] = sc.nextInt(); } questionLength = sc.ne...
[["-", 12, 23, 0, 16, 12, 16, 12, 504, 71, 499], ["+", 12, 23, 0, 16, 12, 16, 12, 504, 71, 499]]
3
626
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int ravel[] = new int[6]; for (int i = 0; i < 6; i++) { ravel[i] = scan.nextInt(); } Dice dice = new Dice(ravel); int q = scan.nextInt(); int ans[] = new int...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int ravel[] = new int[6]; for (int i = 0; i < 6; i++) { ravel[i] = scan.nextInt(); } Dice dice = new Dice(ravel); int q = scan.nextInt(); int ans[] = new int...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
819
import java.text.ParseException; import java.util.Scanner; public class Main { public static void main(String[] arges) throws ParseException { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); String[] deme = line.split(" "); int[] daice = new int[] {Integer.parseInt(deme[0]...
import java.text.ParseException; import java.util.Scanner; public class Main { public static void main(String[] arges) throws ParseException { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); String[] deme = line.split(" "); int[] daice = new int[] {Integer.parseInt(deme[0]...
[["-", 0, 1, 0, 492, 3, 4, 0, 504, 71, 499], ["+", 0, 1, 0, 492, 3, 4, 0, 504, 71, 499]]
3
885
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static double minkDist(int[] a, int[] b, int n, int p) { double result = 0; double max = 0; for (int i = 0; i < n; i++) { result += Math.pow(Math.abs(a[i] - b[i]), p); if...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static double minkDist(int[] a, int[] b, int n, int p) { double result = 0; double max = 0; for (int i = 0; i < n; i++) { result += Math.pow(Math.abs(a[i] - b[i]), p); if...
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
1,139
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] num = new int[6]; for (int i = 0; i < num.length; i++) { num[i] = sc.nextInt(); } Dice dice = new Dice(num); int count = sc.nextInt(); for (int i = 0; ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] num = new int[6]; for (int i = 0; i < num.length; i++) { num[i] = sc.nextInt(); } Dice dice = new Dice(num); int count = sc.nextInt(); for (int i = 0; ...
[["-", 0, 1, 0, 492, 3, 4, 0, 504, 516, 22], ["-", 0, 1, 0, 492, 3, 4, 0, 504, 0, 70], ["-", 0, 492, 3, 4, 0, 504, 71, 16, 17, 33], ["-", 0, 492, 3, 4, 0, 504, 71, 16, 12, 499], ["-", 0, 1, 0, 492, 3, 4, 0, 504, 0, 73]]
3
567
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] dice = new int[6]; for (int x = 0; x < 6; x++) { dice[x] = scan.nextInt(); } int q = scan.nextInt(); for (int x = 0; x < q; x++) { int top = scan.next...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] dice = new int[6]; for (int x = 0; x < 6; x++) { dice[x] = scan.nextInt(); } int q = scan.nextInt(); for (int x = 0; x < q; x++) { int top = scan.next...
[["-", 0, 1, 0, 492, 3, 4, 0, 504, 71, 499], ["+", 0, 1, 0, 492, 3, 4, 0, 504, 71, 499]]
3
694
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); final int DICE = 6; int dice[] = new int[DICE]; int question, front, upsurface, rightside = 0; for (int i = 0; i < DICE; i++) { dice[i] = scan.nextInt(); } ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); final int DICE = 6; int dice[] = new int[DICE]; int question, front, upsurface, rightside = 0; for (int i = 0; i < DICE; i++) { dice[i] = scan.nextInt(); } ...
[["-", 75, 196, 0, 1, 0, 11, 12, 504, 71, 499], ["+", 75, 196, 0, 1, 0, 11, 12, 504, 71, 499]]
3
608
#include <stdio.h> struct dice { int a[6]; int top[24]; int mae[24]; }; struct dice dice1; int main() { int i, n; for (i = 0; i < 6; i++) { scanf("%d", &dice1.a[i]); } scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &dice1.top[i], &dice1.mae[i]); if (dice1.a[0] == dice1.top[i]) {...
#include <stdio.h> struct dice { int a[6]; int top[24]; int mae[24]; }; struct dice dice1; int main() { int i, n; for (i = 0; i < 6; i++) { scanf("%d", &dice1.a[i]); } scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &dice1.top[i], &dice1.mae[i]); if (dice1.a[0] == dice1.top[i]) {...
[["-", 0, 57, 15, 23, 0, 16, 31, 69, 71, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 69, 71, 13]]
0
973
#include <stdio.h> //関数プロトタイプ宣言 void diceRoll(int *d, char *r); int main() { int dice[6]; //サイコロ int q; //質問の数 int up; //サイコロの上面 int front; //サイコロの前面 //サイコロの作成 for (int i = 0; i < 6; i++) { scanf("%d", &dice[i]); } //質問の数の入力 scanf("%d", &q); for (int i = 0; i < q; i++) { //上...
#include <stdio.h> //関数プロトタイプ宣言 void diceRoll(int *d, char *r); int main() { int dice[6]; //サイコロ int q; //質問の数 int up; //サイコロの上面 int front; //サイコロの前面 //サイコロの作成 for (int i = 0; i < 6; i++) { scanf("%d", &dice[i]); } //質問の数の入力 scanf("%d", &q); for (int i = 0; i < q; i++) { //上...
[["-", 0, 57, 15, 23, 0, 16, 31, 69, 71, 13], ["+", 0, 57, 15, 23, 0, 16, 31, 69, 71, 13], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 22]]
0
685
#include <stdio.h> int t[7][7] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; int main(void) { int a, b, i, j, n, x, y, dice[10]; for (i = 0; i < 6; i++) { scanf("%d", &dice[i]); } scanf("%d", &n); for (i = 0;...
#include <stdio.h> int t[7][7] = {{0, 3, 5, 2, 4, 0}, {4, 0, 1, 6, 0, 3}, {2, 6, 0, 0, 1, 5}, {5, 1, 0, 0, 6, 2}, {3, 0, 6, 1, 0, 4}, {0, 4, 2, 5, 3, 0}}; int main(void) { int a, b, i, j, n, x, y, dice[10]; for (i = 0; i < 6; i++) { scanf("%d", &dice[i]); } scanf("%d", &n); for (i = 0;...
[["+", 0, 2, 3, 4, 0, 69, 71, 16, 17, 33], ["+", 0, 2, 3, 4, 0, 69, 71, 16, 12, 13]]
0
253
#include <stdio.h> int main(void) { int i, j, k, n, a, b, dice[7], side[5] = {2, 3, 5, 4, 2}; char order[7][3] = {"", "", "N", "W", "E", "S", "NN"}; for (i = 1; i < 7; i++) scanf("%d", &dice[i]); scanf("%d", &n); //上面を合わせる for (i = 0; i < n; i++) { scanf("%d%d", &a, &b); for (j = 1; dice[j]...
#include <stdio.h> int main(void) { int i, j, k, n, a, b, dice[7], side[5] = {2, 3, 5, 4, 2}; char order[7][3] = {"", "", "N", "W", "E", "S", "NN"}; for (i = 1; i < 7; i++) scanf("%d", &dice[i]); scanf("%d", &n); //上面を合わせる for (i = 0; i < n; i++) { scanf("%d%d", &a, &b); for (j = 1; dice[j]...
[["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 71, 69, 0, 73]]
0
435
#include <stdio.h> int main(void) { int D[7], i, j, n, t, f, T, F; for (i = 1; i <= 6; i++) { scanf("%d", &D[i]); } scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &T, &F); for (j = 1; j <= 6; j++) { if (T == D[j]) t = j; } for (j = 1; j <= 6; j++) { if (F == ...
#include <stdio.h> int main(void) { int D[7], i, j, n, t, f, T, F; for (i = 1; i <= 6; i++) { scanf("%d", &D[i]); } scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &T, &F); for (j = 1; j <= 6; j++) { if (T == D[j]) t = j; } for (j = 1; j <= 6; j++) { if (F == ...
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13]]
0
658
#include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { int dice[6]; int i, j, n; int top, front, right; int top_i, front_i; for (i = 0; i < 6; i++) { scanf("%d", &dice[i]); } scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &top, &front); for (j = 0; j < 6; j++) ...
#include <math.h> #include <stdio.h> #include <stdlib.h> int main(void) { int dice[6]; int i, j, n; int top, front, right; int top_i, front_i; for (i = 0; i < 6; i++) { scanf("%d", &dice[i]); } scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d%d", &top, &front); for (j = 0; j < 6; j++) ...
[["-", 8, 9, 0, 100, 0, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 100, 0, 1, 0, 11, 12, 13]]
0
467
//============================================================================ // dice1 #include <math.h> #include <stdio.h> #include <stdlib.h> typedef struct { int N; int E; int W; int S; int T; int B; } TCycoro; enum { pos1, pos2, pos3, pos4, pos5, pos6, posEND }; char Cmd[101]; //----------------------...
//============================================================================ // dice1 #include <math.h> #include <stdio.h> #include <stdlib.h> typedef struct { int N; int E; int W; int S; int T; int B; } TCycoro; enum { pos1, pos2, pos3, pos4, pos5, pos6, posEND }; char Cmd[101]; //----------------------...
[["-", 0, 99, 8, 9, 0, 100, 0, 37, 0, 22], ["+", 0, 99, 8, 9, 0, 100, 0, 37, 0, 22]]
0
798
#include <stdio.h> #include <stdlib.h> typedef struct dice { int pip[6]; int top, front, right; } Dice; Dice *createDice(int *a); /* ?????????????????? */ int DiceRight(Dice *D, int t, int f); /* ????????????????????´?????°??? */ int main(void) { Dice *D; int i, n, a[6], t, f, ans; for (i = 0;...
#include <stdio.h> #include <stdlib.h> typedef struct dice { int pip[6]; int top, front, right; } Dice; Dice *createDice(int *a); /* ?????????????????? */ int DiceRight(Dice *D, int t, int f); /* ????????????????????´?????°??? */ int main(void) { Dice *D; int i, n, a[6], t, f, ans; for (i = 0;...
[["-", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13], ["+", 0, 43, 49, 50, 51, 83, 0, 83, 0, 13]]
0
461
#include <stdio.h> int main() { int dice[6]; int n, t, f, top, front, i, j; for (i = 0; i < 6; i++) scanf("%d", &dice[i]); scanf("%d", &n); for (j = 0; j < n; j++) { scanf("%d %d", &t, &f); for (i = 0; i < 6; i++) { if (t == dice[i]) top = i; if (f == dice[i]) ...
#include <stdio.h> int main() { int dice[6]; int n, t, f, top, front, i, j; for (i = 0; i < 6; i++) scanf("%d", &dice[i]); scanf("%d", &n); for (j = 0; j < n; j++) { scanf("%d %d", &t, &f); for (i = 0; i < 6; i++) { if (t == dice[i]) top = i; if (f == dice[i]) ...
[["-", 64, 1, 0, 2, 3, 4, 0, 69, 71, 13], ["+", 64, 1, 0, 2, 3, 4, 0, 69, 71, 13], ["-", 64, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 64, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
641
#include <stdio.h> struct dice { int n[6]; // number }; struct dice dice1; void v() // vertical { int mem = 0; mem = dice1.n[0]; dice1.n[0] = dice1.n[4]; dice1.n[4] = dice1.n[5]; dice1.n[5] = dice1.n[1]; dice1.n[1] = mem; } void s() // side { int mem = 0; mem = dice1.n[1]; dice1.n[1] = dice1.n[2]...
#include <stdio.h> struct dice { int n[6]; // number }; struct dice dice1; void v() // vertical { int mem = 0; mem = dice1.n[0]; dice1.n[0] = dice1.n[4]; dice1.n[4] = dice1.n[5]; dice1.n[5] = dice1.n[1]; dice1.n[1] = mem; } void s() // side { int mem = 0; mem = dice1.n[1]; dice1.n[1] = dice1.n[2]...
[["-", 0, 52, 8, 9, 0, 57, 64, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 1, 0, 2, 63, 22], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 24], ["+", 0, 57, 64, 1, 0, 2, 3, 4, 0, 25]]
0
369
#include <stdio.h> int main(int argc, const char *argv[]) { int s[6]; int i, j; int answer[25]; int tmp; int count = 0; int top, front; for (i = 0; i < 6; i++) { scanf("%d", &s[i]); } scanf("%d", &j); for (i = 0; i < j; i++) { scanf("%d", &top); scanf("%d", &front); if (top == s[0])...
#include <stdio.h> int main(int argc, const char *argv[]) { int s[6]; int i, j; int answer[25]; int tmp; int count = 0; int top, front; for (i = 0; i < 6; i++) { scanf("%d", &s[i]); } scanf("%d", &j); for (i = 0; i < j; i++) { scanf("%d", &top); scanf("%d", &front); if (top == s[0])...
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13]]
0
770
// AOJ ITP1_11_B Dice II // 2018.4.29 bal4u #include <stdio.h> int face[7][7][4] = { {{0}, {0}, {0}, {0}, {0}, {0}, {0}}, {{0}, {0}, {0, 1, 2, 3}, {0, 1, 3, 5}, {0, 1, 4, 2}, {0, 1, 5, 4}, {0}}, {{0}, {0, 2, 1, 4}, {0}, {0, 2, 3, 1}, {0, 2, 4, 6}, {0}, {0, 2, 6, 3}}, {{0}, {0, 3, 1, 2}, {0, 3, 2, 6}, ...
// AOJ ITP1_11_B Dice II // 2018.4.29 bal4u #include <stdio.h> int face[7][7][4] = { {{0}, {0}, {0}, {0}, {0}, {0}, {0}}, {{0}, {0}, {0, 1, 2, 3}, {0, 1, 3, 5}, {0, 1, 4, 2}, {0, 1, 5, 4}, {0}}, {{0}, {0, 2, 1, 4}, {0}, {0, 2, 3, 1}, {0, 2, 4, 6}, {0}, {0, 2, 6, 3}}, {{0}, {0, 3, 1, 2}, {0, 3, 2, 6}, ...
[["-", 49, 50, 51, 83, 0, 83, 0, 83, 0, 13], ["+", 49, 50, 51, 83, 0, 83, 0, 83, 0, 13]]
0
513
#include <stdio.h> int Dice(int, int); int main(void) { int i, j, n, D[7]; int x, y; int num[24][2]; for (i = 1; i <= 6; i++) { scanf("%d", &D[i]); } scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &num[i][0], &num[i][1]); } for (i = 0; i < n; i++) { if (num[i][0] == D[1]) ...
#include <stdio.h> int Dice(int, int); int main(void) { int i, n, D[7]; int x, y; int num[24][2]; for (i = 1; i <= 6; i++) { scanf("%d", &D[i]); } scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%d %d", &num[i][0], &num[i][1]); } for (i = 0; i < n; i++) { if (num[i][0] == D[1]) ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 49, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 0, 70], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 0, 73]]
0
685
#include <stdio.h> int main() { int i, j, k, n, a, b, Dice[7], side[5] = {2, 3, 5, 4, 2}; char order[7][3] = {"", "", "N", "W", "E", "S", "NN"}; //ダイスの目の入力 for (i = 1; i < 7; i++) { // 1 ~ 6 Dice[] scanf("%d", &Dice[i]); } //質問の数の入力 scanf("%d", &n); //上面を合わせる //側面の入力 for (i = 0; i < n; i++) ...
#include <stdio.h> int main() { int i, j, k, n, a, b, Dice[7], side[5] = {2, 3, 5, 4, 2}; char order[7][3] = {"", "", "N", "W", "E", "S", "NN"}; //ダイスの目の入力 for (i = 1; i < 7; i++) { // 1 ~ 6 Dice[] scanf("%d", &Dice[i]); } //質問の数の入力 scanf("%d", &n); //上面を合わせる //側面の入力 for (i = 0; i < n; i++) ...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 99, 8, 9, 0, 46]]
0
447
#include <bits/stdc++.h> using namespace std; class dice { public: int d1; int d2; int d3; int d4; int d5; int d6; int kaisi(int s1, int s2, int s3, int s4, int s5, int s6); string huru(string x); int kakunin(int x, int y); }; int dice::kaisi(int s1, int s2, int s3, int s4, int s5, int s6) { d1 = s1...
#include <bits/stdc++.h> using namespace std; class dice { public: int d1; int d2; int d3; int d4; int d5; int d6; int kaisi(int s1, int s2, int s3, int s4, int s5, int s6); string huru(string x); int kakunin(int x, int y); }; int dice::kaisi(int s1, int s2, int s3, int s4, int s5, int s6) { d1 = s1...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
487
#include <iostream> #include <string> #include <vector> using namespace std; enum Face { TOP = 0, FRONT = 1, RIGHT = 2, LEFT = 3, BACK = 4, BOTTOM = 5, }; void roll(vector<int> &f, string cmd) { int tmp; for (int i = 0; i < cmd.size(); i++) { switch (cmd[i]) { case 'E': tmp = f[TOP]; ...
#include <iostream> #include <string> #include <vector> using namespace std; enum Face { TOP = 0, FRONT = 1, RIGHT = 2, LEFT = 3, BACK = 4, BOTTOM = 5, }; void roll(vector<int> &f, string cmd) { int tmp; for (int i = 0; i < cmd.size(); i++) { switch (cmd[i]) { case 'E': tmp = f[TOP]; ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
665
#include <algorithm> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long int ll; typedef std::pair<int, int> pii; typedef std::pair<ll, int> pli; typ...
#include <algorithm> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <string.h> #include <string> #include <vector> using namespace std; typedef long long int ll; typedef std::pair<int, int> pii; typedef std::pair<ll, int> pli; typ...
[["-", 0, 1, 0, 11, 12, 69, 341, 342, 0, 13], ["+", 0, 1, 0, 11, 12, 69, 341, 342, 0, 13]]
1
713
#include <cmath> #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { const int n = 6; int dice[n]; int top, front; int p; int dice_result[6]; /* const int dice_tem[4][6] ={ {2,6,3,4,1,5},{5,1,3,4,6,2}, {4,2,1,6,5,3},{3,2,6,1,5,4}};*/ const int dice_tem[4][6] =...
#include <cmath> #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { const int n = 6; int dice[n]; int top, front; int p; int dice_result[6]; /* const int dice_tem[4][6] ={ {2,6,3,4,1,5},{5,1,3,4,6,2}, {4,2,1,6,5,3},{3,2,6,1,5,4}};*/ const int dice_tem[4][6] =...
[["-", 0, 43, 49, 50, 51, 41, 75, 41, 64, 13], ["+", 0, 43, 49, 50, 51, 41, 75, 41, 64, 13], ["-", 49, 50, 51, 41, 75, 41, 75, 41, 64, 13], ["+", 49, 50, 51, 41, 75, 41, 75, 41, 64, 13]]
1
395
//チェッカーコンパイルエラー #include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; class dice { private: int roll[6]; public: explicit dice(int in[6]) { for (int i = 0; i < 6; i++) roll[i] = in[i]; } void move(const char c) { int tmp; switch (c) { case 'N': tmp = roll[0];...
//チェッカーコンパイルエラー #include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; class dice { private: int roll[6]; public: explicit dice(int in[6]) { for (int i = 0; i < 6; i++) roll[i] = in[i]; } void move(const char c) { int tmp; switch (c) { case 'N': tmp = roll[0];...
[["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]]
1
592
#include <iostream> using namespace std; int main(void) { // Your code here! int dice[6]{}; for (int i = 0; i < 6; i++) cin >> dice[i]; int a, b; int dicee[6]{}; for (int i = 0; i < 6; i++) dicee[i] = dice[i]; int n; cin >> n; for (int k = 0; k < n; k++) { cin >> a >> b; // up-a in...
#include <iostream> using namespace std; int main(void) { // Your code here! int dice[6]{}; for (int i = 0; i < 6; i++) cin >> dice[i]; int a, b; int dicee[6]{}; for (int i = 0; i < 6; i++) dicee[i] = dice[i]; int n; cin >> n; for (int k = 0; k < n; k++) { cin >> a >> b; // up-a in...
[["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 13]]
1
568
#include <iostream> using namespace std; int main() { int dice[6]; int n; int x, y; for (int i = 0; i < 6; i++) { cin >> dice[i]; } cin >> n; for (int i = 0; i < n; i++) { cin >> x >> y; if ((x == dice[3] && y == dice[1]) || (x == dice[4] && y == dice[3]) || (x == dice[2] && y == dice[...
#include <iostream> using namespace std; int main() { int dice[6]; int n; int x, y; for (int i = 0; i < 6; i++) { cin >> dice[i]; } cin >> n; for (int i = 0; i < n; i++) { cin >> x >> y; if ((x == dice[3] && y == dice[1]) || (x == dice[4] && y == dice[3]) || (x == dice[2] && y == dice[...
[["+", 51, 16, 12, 23, 0, 16, 12, 16, 31, 22], ["+", 51, 16, 12, 23, 0, 16, 12, 16, 17, 60]]
1
543
#include <iostream> #include <vector> using namespace std; // http://www.prefield.com/algorithm/misc/dice.html enum FACE { TOP, BOTTOM, FRONT, BACK, LEFT, RIGHT }; class dice { public: dice() { id[TOP] = 1; id[FRONT] = 2; id[LEFT] = 3; id[RIGHT] = 4; id[BACK] = 5; id[BOTTOM] = 6; } dice(i...
#include <iostream> #include <vector> using namespace std; // http://www.prefield.com/algorithm/misc/dice.html enum FACE { TOP, BOTTOM, FRONT, BACK, LEFT, RIGHT }; class dice { public: dice() { id[TOP] = 1; id[FRONT] = 2; id[LEFT] = 3; id[RIGHT] = 4; id[BACK] = 5; id[BOTTOM] = 6; } dice(i...
[["-", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 16, 31, 16, 12, 69, 341, 342, 0, 22]]
1
662
#include <iostream> #include <sstream> using namespace std; class Dice { public: static int rollingface[][4]; static int sideface[][4]; int face[6]; Dice(string &face_data); // ~Dice(); void roll(const char &op); int top(); int front_face(int top, int right); void print_faces(); }; int Dice::rollin...
#include <iostream> #include <sstream> using namespace std; class Dice { public: static int rollingface[][4]; static int sideface[][4]; int face[6]; Dice(string &face_data); // ~Dice(); void roll(const char &op); int top(); int front_face(int top, int right); void print_faces(); }; int Dice::rollin...
[["+", 341, 342, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 341, 342, 0, 16, 31, 23, 0, 16, 12, 13]]
1
664
#include <iostream> using namespace std; class Dice { public: int top; int front; int right; int left; int back; int bottom; Dice(int a, int b, int c, int d, int e, int f) { top = a; front = b; right = c; left = d; back = e; bottom = f; } void rotateN() { int t = top; ...
#include <iostream> using namespace std; class Dice { public: int top; int front; int right; int left; int back; int bottom; Dice(int a, int b, int c, int d, int e, int f) { top = a; front = b; right = c; left = d; back = e; bottom = f; } void rotateN() { int t = top; ...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 43, 49, 53, 54, 55, 0, 21], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 21], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
442
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string.h> #include <string> #include <vector> using namespace std; // const int sss[10] = { 0, 6, 5, 4, 3, 2, 1 }; struct DICE { int f[8]; }; DICE dice; int ch(char a) { int s[60]; for (int i = 1; i < 7; i++) { s[i] = dice....
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string.h> #include <string> #include <vector> using namespace std; // const int sss[10] = { 0, 6, 5, 4, 3, 2, 1 }; struct DICE { int f[8]; }; DICE dice; int ch(char a) { int s[60]; for (int i = 1; i < 7; i++) { s[i] = dice....
[["+", 0, 99, 8, 9, 0, 100, 0, 93, 0, 94], ["+", 0, 99, 8, 9, 0, 100, 0, 93, 0, 35]]
1
583
#include <cstdlib> #include <iostream> #include <string> using namespace std; class Dice { public: int label[6]; void Command(char hougaku); }; void Dice::Command(char hougaku) { int temp[6]; for (int i = 0; i < 6; i++) { temp[i] = label[i]; } if (hougaku == 'E') { label[0] = temp[3]; label[2...
#include <cstdlib> #include <iostream> #include <string> using namespace std; class Dice { public: int label[6]; void Command(char hougaku); }; void Dice::Command(char hougaku) { int temp[6]; for (int i = 0; i < 6; i++) { temp[i] = label[i]; } if (hougaku == 'E') { label[0] = temp[3]; label[2...
[["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 35]]
1
497
#include <iostream> #include <string> using namespace std; void diceS(int[]); void diceE(int[]); void diceW(int[]); void diceN(int[]); void diceR(int[]); int main() { int d[6], p, n, m; string str; for (int i = 0; i < 6; i++) cin >> d[i]; cin >> p; while (p--) { cin >> n >> m; for (int k = 0; k ...
#include <iostream> #include <string> using namespace std; void diceS(int[]); void diceE(int[]); void diceW(int[]); void diceN(int[]); void diceR(int[]); int main() { int d[6], p, n, m; string str; for (int i = 0; i < 6; i++) cin >> d[i]; cin >> p; while (p--) { cin >> n >> m; for (int k = 0; k ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 13]]
1
496