More actions
imported>chackford No edit summary |
imported>tag0123 No edit summary |
||
| Line 38: | Line 38: | ||
} | } | ||
== 기생충 == | == 기생충 == | ||
public class Ship { | |||
public int maxNum; | |||
public int cur; | |||
public Ship(int n){ | |||
maxNum = n; | |||
cur = 0; | |||
} | |||
public void take(){ | |||
cur++; | |||
} | |||
public void getOff(){ | |||
cur--; | |||
} | |||
public boolean cross(){ | |||
return (maxNum >= cur); | |||
} | |||
} | |||
public class BadUncle { | |||
public boolean location; | |||
public BadUncle(){location = true;} | |||
public void ThrowRook(ProfessorR r, Child c) { | |||
if( r.location != c.location && location == c.location ) | |||
killRook(); | |||
} | |||
public void crossRiver() { | |||
if(location) location = false; | |||
else location = true; | |||
} | |||
public void printLocation() { | |||
String str = (location)? "A" : "B"; | |||
System.out.println("Uncle loc : " + str); | |||
} | |||
private void killRook() { | |||
System.out.println("루크 죽음 ㅋ"); | |||
} | |||
} | |||
public class Child { | |||
public boolean location; | |||
public Child() { | |||
location = true; | |||
} | |||
public void crossRiver(ProfessorR r) { | |||
if( r.location == location ) { | |||
if(location) { | |||
location = false; | |||
r.location = false; | |||
} | |||
else { | |||
location = true; | |||
r.location = true; | |||
} | |||
} | |||
} | |||
public void printLocation() { | |||
String str = (location)? "A" : "B"; | |||
System.out.println("Child loc : " + str); | |||
} | |||
} | |||
public class ProfessorR { | |||
public boolean location; | |||
public ProfessorR() { | |||
location = true; | |||
} | |||
public void crossRiver() { | |||
if(location) location = false; | |||
else location = true; | |||
} | |||
public void printLocation() { | |||
String str = (location)? "A" : "B"; | |||
System.out.println("Professor loc : " + str); | |||
} | |||
public static void main(String[] args) { | |||
ProfessorR test = new ProfessorR(); | |||
Child rook = new Child(); | |||
test.printLocation(); | |||
test.crossRiver(); | |||
test.printLocation(); | |||
test.crossRiver(); | |||
test.printLocation(); | |||
rook.printLocation(); | |||
rook.crossRiver(test); | |||
rook.printLocation(); | |||
test.printLocation(); | |||
BadUncle b = new BadUncle(); | |||
test.crossRiver(); | |||
b.crossRiver(); | |||
test.printLocation(); | |||
b.printLocation(); | |||
rook.printLocation(); | |||
b.ThrowRook(test, rook); | |||
} | |||
} | |||
Revision as of 11:01, 4 April 2011
쓰레기
핸드폰이 죽었슴다
Untitled.txt
#include <stdio.h>
typedef struct _h {
int id;
} human;
typedef struct _t {
human h[3];
} town;
int main(int argc, const char **argv) {
human raten, ruke, bad, pl1, pl2, pl3;
town a, b;
a.h[0] = raten;
a.h[1] = ruke;
a.h[2] = bad;
b.h[0] =a.h[0];
b.h[1]=a.h[1];
a.h[0]=pl1;
a.h[1]=pl2;
a.h[0]=b.h[0];
b.h[0]=pl1;
b.h[0]=a.h[0];
b.h[2]=a.h[2];
a.h[0]=pl1;
a.h[2]=pl3;
return 0;
}
기생충
public class Ship {
public int maxNum;
public int cur;
public Ship(int n){
maxNum = n;
cur = 0;
}
public void take(){
cur++;
}
public void getOff(){
cur--;
}
public boolean cross(){
return (maxNum >= cur);
}
}
public class BadUncle {
public boolean location;
public BadUncle(){location = true;}
public void ThrowRook(ProfessorR r, Child c) {
if( r.location != c.location && location == c.location )
killRook();
}
public void crossRiver() {
if(location) location = false;
else location = true;
}
public void printLocation() {
String str = (location)? "A" : "B";
System.out.println("Uncle loc : " + str);
}
private void killRook() {
System.out.println("루크 죽음 ㅋ");
}
}
public class Child {
public boolean location;
public Child() {
location = true;
}
public void crossRiver(ProfessorR r) {
if( r.location == location ) {
if(location) {
location = false;
r.location = false;
}
else {
location = true;
r.location = true;
}
}
}
public void printLocation() {
String str = (location)? "A" : "B";
System.out.println("Child loc : " + str);
}
}
public class ProfessorR {
public boolean location;
public ProfessorR() {
location = true;
}
public void crossRiver() {
if(location) location = false;
else location = true;
}
public void printLocation() {
String str = (location)? "A" : "B";
System.out.println("Professor loc : " + str);
}
public static void main(String[] args) {
ProfessorR test = new ProfessorR();
Child rook = new Child();
test.printLocation();
test.crossRiver();
test.printLocation();
test.crossRiver();
test.printLocation();
rook.printLocation();
rook.crossRiver(test);
rook.printLocation();
test.printLocation();
BadUncle b = new BadUncle();
test.crossRiver();
b.crossRiver();
test.printLocation();
b.printLocation();
rook.printLocation();
b.ThrowRook(test, rook);
}
}