Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NEVA_GI_FAR(GG); //THE TRANSIST0R
- MATRIX_RAW_CODez(INIT_XaR0Rxc_ID-MUTEX<ggXZ<<>><<<<<<<<><>>>>>><>>>>>>>><>>>>>>>>>><<);
- sdihfjkhfiusetawpo45tv4åtåsbun6 //CSV,comma-H
- opi54¨s395uybä5ms9pnmäsp95umas4
- 80vn5å346m80bå0er9ynu3på48ov7n+
- asp4896båë+0+0+0+0+05nås0mvts84
- otivusroseå
- tnboeitunbeosse48888888u#######
- ###############################
- ###############################
- ###############################
- ##########!####################
- ###############################
- ###########!#######!###########
- ###########!!##!################ //EBX?
- ############################### //JMP
- ##################!!###########
- #########!#####################
- ###!########################### //SKP
- ##############!!##########!!##### //HOP?
- ###############################
- ###################!###########
- ###########!###################
- ###############################
- ###############################
- #####!"=="(HANDLAR_OMauepovuier
- ytvnXixciixcixccxciixcxcixcixci
- ixciixcixcxicicxiiciixcicixcici
- xcixicixicicixicixiicixiciixcii
- !cixcixciixiiciixicixciixcicixc
- ixicixicxicixiicxiic==FIXA(PRB) //-LEM
- ########!!#!########!#######!!!##############!!!################### //UNRELATED_LOL
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
- public **df -h**
- Filesystem Size Used Avail Use% Mounted on
- /dev/md2 909G 775G 88G 90% /
- udev 3.8G 4.0K 3.8G 1% /dev
- tmpfs 1.6G 352K 1.6G 1% /run
- none 5.0M 0 5.0M 0% /run/lock
- none 3.8G 0 3.8G 0% /run/shm
- /dev/md0 458M 25M 409M 6% /boot
- **cat /etc/fstab**
- # /etc/fstab: static file system information.
- #
- # Use 'blkid' to print the universally unique identifier for a
- # device; this may be used with UUID= as a more robust way to name devices
- # that works even if disks are added and removed. See fstab(5).
- #
- # <file system> <mount point> <type> <options> <dump> <pass>
- proc /proc proc nodev,noexec,nosuid 0 0
- # / was on /dev/md2 during installation
- UUID=2d22fd63-9d2e-494c-92d9-89f411fb1b5d / ext4 errors=remount-ro,usrquota 0 1
- # /boot was on /dev/md0 during installation
- UUID=b99dbfa5-fad2-4ba0-b741-70bd8ddff90e /boot ext2 defaults 0 2
- # swap was on /dev/md1 during installation
- UUID=2d72a698-9c6c-4d81-9ed9-3d7ebe544e45 none swap sw 0 0
- **cat /proc/mdstat**
- Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
- md0 : active raid1 sda2[0]
- 499712 blocks super 1.2 [2/1] [U_]
- md1 : active raid1 sda3[0]
- 7995840 blocks super 1.2 [2/1] [U_]
- md2 : active raid1 sda4[0]
- 968130304 blocks super 1.2 [2/1] [U_]
- **mdadm -D /dev/md0**
- /dev/md0:
- Version : 1.2
- Creation Time : Wed Jun 19 12:04:15 2013
- Raid Level : raid1
- Array Size : 499712 (488.08 MiB 511.71 MB)
- Used Dev Size : 499712 (488.08 MiB 511.71 MB)
- Raid Devices : 2
- Total Devices : 1
- Persistence : Superblock is persistent
- Update Time : Thu Apr 30 06:29:27 2015
- State : clean, degraded
- Active Devices : 1
- Working Devices : 1
- Failed Devices : 0
- Spare Devices : 0
- Name : paris086:0 (local to host paris086)
- UUID : ceba0bd5:ffa466c8:7e950165:71dc000d
- Events : 118
- Number Major Minor RaidDevice State
- 0 8 2 0 active sync /dev/sda2
- 1 0 0 1 removed
- **mdadm -D /dev/md1**
- /dev/md1:
- Version : 1.2
- Creation Time : Wed Jun 19 12:04:15 2013
- Raid Level : raid1
- Array Size : 7995840 (7.63 GiB 8.19 GB)
- Used Dev Size : 7995840 (7.63 GiB 8.19 GB)
- Raid Devices : 2
- Total Devices : 1
- Persistence : Superblock is persistent
- Update Time : Thu Apr 30 13:04:46 2015
- State : clean, degraded
- Active Devices : 1
- Working Devices : 1
- Failed Devices : 0
- Spare Devices : 0
- Name : paris086:1 (local to host paris086)
- UUID : dd350924:63d6b46f:4cb885f3:11f2b430
- Events : 791
- Number Major Minor RaidDevice State
- 0 8 3 0 active sync /dev/sda3
- 1 0 0 1 removed
- **mdadm -D /dev/md2**
- /dev/md2:
- Version : 1.2
- Creation Time : Wed Jun 19 12:04:15 2013
- Raid Level : raid1
- Array Size : 968130304 (923.28 GiB 991.37 GB)
- Used Dev Size : 968130304 (923.28 GiB 991.37 GB)
- Raid Devices : 2
- Total Devices : 1
- Persistence : Superblock is persistent
- Update Time : Thu Apr 30 13:35:25 2015
- State : clean, degraded
- Active Devices : 1
- Working Devices : 1
- Failed Devices : 0
- Spare Devices : 0
- Name : paris086:2 (local to host paris086)
- UUID : 2b8bd77e:7fc2806b:56ae349f:01473330
- Events : 539748
- Number Major Minor RaidDevice State
- 0 8 4 0 active sync /dev/sda4
- 1 0 0 1 removed
- A Fail event had been detected on md device /dev/md/2.
- It could be related to component device /dev/sdb4.
- P.S. The /proc/mdstat file currently contains the following:
- Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
- md0 : active raid1 sdb2[1] sda2[0]
- 499712 blocks super 1.2 [2/2] [UU]
- md1 : active raid1 sdb3[1](F) sda3[0]
- 7995840 blocks super 1.2 [2/1] [U_]
- md2 : active raid1 sdb4[1](F) sda4[0]
- 968130304 blocks super 1.2 [2/1] [U_]
- A Fail event had been detected on md device /dev/md/1.
- It could be related to component device /dev/sdb3.
- Faithfully yours, etc.
- P.S. The /proc/mdstat file currently contains the following:
- Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
- md0 : active raid1 sdb2[1] sda2[0]
- 499712 blocks super 1.2 [2/2] [UU]
- md1 : active raid1 sdb3[1](F) sda3[0]
- 7995840 blocks super 1.2 [2/1] [U_]
- md2 : active raid1 sdb4[1](F) sda4[0]
- 968130304 blocks super 1.2 [2/1] [U_]
- A Fail event had been detected on md device /dev/md/0.
- It could be related to component device /dev/sdb2.
- Faithfully yours, etc.
- P.S. The /proc/mdstat file currently contains the following:
- Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
- md0 : active raid1 sdb2[1](F) sda2[0]
- 499712 blocks super 1.2 [2/1] [U_]
- md1 : active raid1 sdb3[1](F) sda3[0]
- 7995840 blocks super 1.2 [2/1] [U_]class BigInteger
- {
- public static final String QUIT_COMMAND = "quit";
- public static final String MSG_INVALID_INPUT = "입력이 잘못되었습니다.";
- public static final Pattern EXPRESSION_PATTERN = Pattern.compile("^\\s*[-+]?[0-9]+\\s*[+*-]\\s*[-+]?[0-9]+\\s*$");
- //BigInteger member state
- private int[] data;
- private int length;
- // BinInteger Constructor
- public BigInteger(int i)
- {
- length=lengthOf(i);
- data = new int[length];
- for(int j=0; j<length; j++)
- {
- data[j]=i%10;
- i/=10;
- }
- }
- public BigInteger(int[] num1)
- {
- length=num1.length;
- data = new int[length];
- System.arraycopy(num1, 0, data, 0, length);
- }
- public BigInteger(String s)
- {
- int sign = 1;
- switch(s.charAt(0))
- {
- case '-':
- sign = -1;
- case '+':
- length = s.length()-1;
- data = new int[length];
- for(int i = 0; i < length ; i++)
- {
- data[i] = sign * Character.getNumericValue(s.charAt(length-i));
- }
- break;
- default:
- length = s.length();
- data = new int[length];
- for(int i =0 ; i<length; i++)
- {
- data[i] = Character.getNumericValue(s.charAt(length-i-1));
- }
- }
- }
- //BigInteger Method
- public BigInteger add(BigInteger big)
- {
- int[] resultData = new int[((this.length>big.length)? this.length : big.length)+1];
- //add digit by digit
- for(int i = 0 ; i<this.length ; i++)
- resultData[i] = this.data[i];
- for(int i = 0 ; i<big.length; i++)
- resultData[i] += big.data[i];
- //handling CarryIn
- resultData = handlingCarryIn(resultData);
- resultData = deleteZero(resultData);
- //digit sign correction
- resultData = correctDigitSign(resultData);
- resultData = deleteZero(resultData);
- return new BigInteger(resultData);
- }
- public BigInteger subtract(BigInteger big)
- {
- return this.add(big.multiply(new BigInteger(-1)));
- }
- public BigInteger multiply(BigInteger big)
- {
- int[] resultData = new int[this.length+big.length];
- //multiply
- for(int i = 0 ; i<big.length; i++)
- {
- for(int j = 0; j<this.length; j++)
- {
- resultData[i+j]+=this.data[j] * big.data[i];
- }
- }
- //Handling CarryIn
- resultData = handlingCarryIn(resultData);
- resultData = deleteZero(resultData);
- return new BigInteger(resultData);
- }
- //@Override
- public String toString()
- {
- String result = "";
- result = result + data[length-1];
- for(int i = 1 ; i < length ; i++)
- result = result + Math.abs(data[length-1-i]);
- return result;
- }
- static BigInteger evaluate(String input) throws IllegalArgumentException
- {
- //Check validity
- if(!isValid(input))
- throw new IllegalArgumentException();
- //parse input and store parsed data at lhs, operator,rhs
- String lhs = parseOperand(input);
- input = deleteFirstAndTrim(input, lhs);//if we parsed lhs, delete lhs from input
- lhs = deleteZero(lhs);
- char operator = input.charAt(0);
- input = deleteFirstAndTrim(input, "[-+*]");
- String rhs = parseOperand(input);
- rhs = deleteZero(rhs);
- //make bigInteger Instance by parsed String and evaluate
- BigInteger num1 = new BigInteger(lhs);
- BigInteger num2 = new BigInteger(rhs);
- BigInteger result = evaluateResult(num1, operator, num2);
- return result;
- }
- public static void main(String[] args) throws Exception
- {
- try (InputStreamReader isr = new InputStreamReader(System.in))
- {
- try (BufferedReader reader = new BufferedReader(isr))
- {
- boolean done = false;
- while (!done)
- {
- String input = reader.readLine();
- try
- {
- done = processInput(input);
- }
- catch (IllegalArgumentException e)
- {
- System.err.println(MSG_INVALID_INPUT);
- }
- }
- }
- }
- }
- static boolean processInput(String input) throws IllegalArgumentException
- {
- boolean quit = isQuitCmd(input);
- if (quit)
- {
- return true;
- }
- else
- {
- BigInteger result = evaluate(input);
- System.out.println(result.toString());
- return false;
- }
- }
- static boolean isQuitCmd(String input)
- {
- return input.equalsIgnoreCase(QUIT_COMMAND);
- }
- //check validity
- static boolean isValid(String input)
- {
- Matcher m = EXPRESSION_PATTERN.matcher(input);
- return m.find();
- }
- //get rid of the first 'delete' from the target and trim.
- static String deleteFirstAndTrim(String target, String delete)
- {
- if(delete.charAt(0)=='+')
- delete="\\"+delete; //for regex started with +
- target=target.replaceFirst(delete, "");
- target=target.trim();
- return target;
- }
- //Operand Parser
- static String parseOperand(String input)
- {
- Pattern p = Pattern.compile("[+-]?[0-9]+");
- Matcher m = p.matcher(input);
- m.find();
- return m.group();
- }
- //Selection Method
- static BigInteger evaluateResult(BigInteger lhs, char op, BigInteger rhs) throws IllegalArgumentException
- {
- switch(op)
- {
- case '+':
- return lhs.add(rhs);
- case '-':
- return lhs.subtract(rhs);
- case '*':
- return lhs.multiply(rhs);
- default:
- throw new IllegalArgumentException();
- }
- }
- static int lengthOf(int i)
- {
- int result = 1;
- boolean done = false;
- while(!done)
- {
- if(i/10!=0)
- {
- result++;
- i=i/10;
- continue;
- }
- else break;
- }
- return result;
- }
- static boolean isSign(char c)
- {
- return (c=='+'||c=='-');
- }
- //delete meaningless Zero
- static String deleteZero(String input)
- {
- int index = 0;
- if(isSign(input.charAt(0)))
- index++;
- while(input.charAt(index)=='0'&&index!=input.length()-1)
- {
- input=input.replaceFirst("0", "");
- }
- return input;
- }
- static int[] deleteZero(int[] input)
- {
- int count = 0;
- int index = input.length-1;
- while(input[index]==0&&index!=0)
- {
- count++;
- index--;
- }
- int[] result = new int[input.length-count];
- System.arraycopy(input, 0, result, 0, result.length);
- return result;
- }
- static int[] handlingCarryIn(int[] input)
- {
- for(int i = 0 ; i<input.length-1; i++)
- {
- if(input[i]/10!=0)
- {
- input[i+1]+=input[i]/10;
- input[i]%=10;
- }
- }
- return input;
- }
- static int[] correctDigitSign(int[] input)
- {
- int sign = (input[input.length-1]>0 ? 1 : -1);
- for(int i = input.length-2 ; i>=0; i--)
- {
- if(input[i]*sign<0)
- {
- input[i+1]-=sign;
- input[i]+=sign*10;
- }
- }
- return input;
- }
- }
- //PART REPOST, TEH_TRANSISTOR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement