/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { { Player5 p = new Player5(); while( p.isAlive() ){ p.print(); p.heal(); p.work(); } p.print(); } } class Player4b{ protected int hp; private int place; public Player4b(){ hp = 100; place = 0; } public void work(){ if( 3 <= hp ){ hp -= 3; place ++; } else { } } public boolean isAlive(){ if( 1 <= hp ){ return true; } else { return false; } } public void print(){ } } class Player5 extends Player4b{ public void heal(){ hp += 1; } }
Standard input is empty
100, 0 98, 1 96, 2 94, 3 92, 4 90, 5 88, 6 86, 7 84, 8 82, 9 80, 10 78, 11 76, 12 74, 13 72, 14 70, 15 68, 16 66, 17 64, 18 62, 19 60, 20 58, 21 56, 22 54, 23 52, 24 50, 25 48, 26 46, 27 44, 28 42, 29 40, 30 38, 31 36, 32 34, 33 32, 34 30, 35 28, 36 26, 37 24, 38 22, 39 20, 40 18, 41 16, 42 14, 43 12, 44 10, 45 8, 46 6, 47 4, 48 2, 49 0, 50