Advertisement
neurrowcat_kattzukic

Mut_EX-iD

Apr 30th, 2015
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 13.57 KB | None | 0 0
  1. NEVA_GI_FAR(GG);            //THE TRANSIST0R
  2.  
  3. MATRIX_RAW_CODez(INIT_XaR0Rxc_ID-MUTEX<ggXZ<<>><<<<<<<<><>>>>>><>>>>>>>><>>>>>>>>>><<);
  4. sdihfjkhfiusetawpo45tv4åtåsbun6                                   //CSV,comma-H
  5. opi54¨s395uybä5ms9pnmäsp95umas4
  6. 80vn5å346m80bå0er9ynu3på48ov7n+
  7. asp4896båë+0+0+0+0+05nås0mvts84
  8. otivusroseå
  9. tnboeitunbeosse48888888u#######
  10. ###############################
  11. ###############################
  12. ###############################
  13. ##########!####################
  14. ###############################
  15. ###########!#######!###########
  16. ###########!!##!################        //EBX?
  17. ###############################         //JMP
  18. ##################!!###########
  19. #########!#####################
  20. ###!###########################         //SKP
  21. ##############!!##########!!#####       //HOP?
  22. ###############################
  23. ###################!###########
  24. ###########!###################
  25. ###############################
  26. ###############################
  27. #####!"=="(HANDLAR_OMauepovuier
  28. ytvnXixciixcixccxciixcxcixcixci
  29. ixciixcixcxicicxiiciixcicixcici
  30. xcixicixicicixicixiicixiciixcii
  31. !cixcixciixiiciixicixciixcicixc
  32. ixicixicxicixiicxiic==FIXA(PRB)             //-LEM
  33.  
  34. ########!!#!########!#######!!!##############!!!################### //UNRELATED_LOL
  35.  
  36. import java.io.BufferedReader;
  37. import java.io.InputStreamReader;
  38. import java.util.regex.Matcher;
  39. import java.util.regex.Pattern;
  40.  
  41. public **df -h**
  42. Filesystem      Size  Used Avail Use% Mounted on
  43. /dev/md2        909G  775G   88G  90% /
  44. udev            3.8G  4.0K  3.8G   1% /dev
  45. tmpfs           1.6G  352K  1.6G   1% /run
  46. none            5.0M     0  5.0M   0% /run/lock
  47. none            3.8G     0  3.8G   0% /run/shm
  48. /dev/md0        458M   25M  409M   6% /boot
  49.  
  50. **cat /etc/fstab**
  51. # /etc/fstab: static file system information.
  52. #
  53. # Use 'blkid' to print the universally unique identifier for a
  54. # device; this may be used with UUID= as a more robust way to name devices
  55. # that works even if disks are added and removed. See fstab(5).
  56. #
  57. # <file system> <mount point>   <type>  <options>       <dump>  <pass>
  58. proc            /proc           proc    nodev,noexec,nosuid 0       0
  59. # / was on /dev/md2 during installation
  60. UUID=2d22fd63-9d2e-494c-92d9-89f411fb1b5d /               ext4    errors=remount-ro,usrquota 0       1
  61. # /boot was on /dev/md0 during installation
  62. UUID=b99dbfa5-fad2-4ba0-b741-70bd8ddff90e /boot           ext2    defaults        0       2
  63. # swap was on /dev/md1 during installation
  64. UUID=2d72a698-9c6c-4d81-9ed9-3d7ebe544e45 none            swap    sw              0       0
  65.  
  66. **cat /proc/mdstat**
  67. Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
  68. md0 : active raid1 sda2[0]
  69.       499712 blocks super 1.2 [2/1] [U_]
  70.  
  71. md1 : active raid1 sda3[0]
  72.       7995840 blocks super 1.2 [2/1] [U_]
  73.  
  74. md2 : active raid1 sda4[0]
  75.       968130304 blocks super 1.2 [2/1] [U_]
  76.  
  77. **mdadm -D /dev/md0**
  78. /dev/md0:
  79.         Version : 1.2
  80.   Creation Time : Wed Jun 19 12:04:15 2013
  81.      Raid Level : raid1
  82.      Array Size : 499712 (488.08 MiB 511.71 MB)
  83.   Used Dev Size : 499712 (488.08 MiB 511.71 MB)
  84.    Raid Devices : 2
  85.   Total Devices : 1
  86.     Persistence : Superblock is persistent
  87.  
  88.     Update Time : Thu Apr 30 06:29:27 2015
  89.           State : clean, degraded
  90.  Active Devices : 1
  91. Working Devices : 1
  92.  Failed Devices : 0
  93.   Spare Devices : 0
  94.  
  95.            Name : paris086:0  (local to host paris086)
  96.            UUID : ceba0bd5:ffa466c8:7e950165:71dc000d
  97.          Events : 118
  98.  
  99.     Number   Major   Minor   RaidDevice State
  100.        0       8        2        0      active sync   /dev/sda2
  101.        1       0        0        1      removed
  102.  
  103. **mdadm -D /dev/md1**
  104. /dev/md1:
  105.         Version : 1.2
  106.   Creation Time : Wed Jun 19 12:04:15 2013
  107.      Raid Level : raid1
  108.      Array Size : 7995840 (7.63 GiB 8.19 GB)
  109.   Used Dev Size : 7995840 (7.63 GiB 8.19 GB)
  110.    Raid Devices : 2
  111.   Total Devices : 1
  112.     Persistence : Superblock is persistent
  113.  
  114.     Update Time : Thu Apr 30 13:04:46 2015
  115.           State : clean, degraded
  116.  Active Devices : 1
  117. Working Devices : 1
  118.  Failed Devices : 0
  119.   Spare Devices : 0
  120.  
  121.            Name : paris086:1  (local to host paris086)
  122.            UUID : dd350924:63d6b46f:4cb885f3:11f2b430
  123.          Events : 791
  124.  
  125.     Number   Major   Minor   RaidDevice State
  126.        0       8        3        0      active sync   /dev/sda3
  127.        1       0        0        1      removed
  128.  
  129. **mdadm -D /dev/md2**
  130. /dev/md2:
  131.         Version : 1.2
  132.   Creation Time : Wed Jun 19 12:04:15 2013
  133.      Raid Level : raid1
  134.      Array Size : 968130304 (923.28 GiB 991.37 GB)
  135.   Used Dev Size : 968130304 (923.28 GiB 991.37 GB)
  136.    Raid Devices : 2
  137.   Total Devices : 1
  138.     Persistence : Superblock is persistent
  139.  
  140.     Update Time : Thu Apr 30 13:35:25 2015
  141.           State : clean, degraded
  142.  Active Devices : 1
  143. Working Devices : 1
  144.  Failed Devices : 0
  145.   Spare Devices : 0
  146.  
  147.            Name : paris086:2  (local to host paris086)
  148.            UUID : 2b8bd77e:7fc2806b:56ae349f:01473330
  149.          Events : 539748
  150.  
  151.     Number   Major   Minor   RaidDevice State
  152.        0       8        4        0      active sync   /dev/sda4
  153.        1       0        0        1      removed
  154.        
  155. A Fail event had been detected on md device /dev/md/2.
  156.  
  157. It could be related to component device /dev/sdb4.
  158.  
  159. P.S. The /proc/mdstat file currently contains the following:
  160.  
  161. Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
  162. md0 : active raid1 sdb2[1] sda2[0]
  163.       499712 blocks super 1.2 [2/2] [UU]
  164.  
  165. md1 : active raid1 sdb3[1](F) sda3[0]
  166.       7995840 blocks super 1.2 [2/1] [U_]
  167.  
  168. md2 : active raid1 sdb4[1](F) sda4[0]
  169.       968130304 blocks super 1.2 [2/1] [U_]
  170.        
  171. A Fail event had been detected on md device /dev/md/1.
  172.  
  173. It could be related to component device /dev/sdb3.
  174.  
  175. Faithfully yours, etc.
  176.  
  177. P.S. The /proc/mdstat file currently contains the following:
  178.  
  179. Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
  180. md0 : active raid1 sdb2[1] sda2[0]
  181.       499712 blocks super 1.2 [2/2] [UU]
  182.  
  183. md1 : active raid1 sdb3[1](F) sda3[0]
  184.       7995840 blocks super 1.2 [2/1] [U_]
  185.  
  186. md2 : active raid1 sdb4[1](F) sda4[0]
  187.       968130304 blocks super 1.2 [2/1] [U_]
  188.        
  189. A Fail event had been detected on md device /dev/md/0.
  190.  
  191. It could be related to component device /dev/sdb2.
  192.  
  193. Faithfully yours, etc.
  194.  
  195. P.S. The /proc/mdstat file currently contains the following:
  196.  
  197. Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
  198. md0 : active raid1 sdb2[1](F) sda2[0]
  199.       499712 blocks super 1.2 [2/1] [U_]
  200.  
  201. md1 : active raid1 sdb3[1](F) sda3[0]
  202.       7995840 blocks super 1.2 [2/1] [U_]class BigInteger
  203. {
  204.   public static final String QUIT_COMMAND = "quit";
  205.   public static final String MSG_INVALID_INPUT = "입력이 잘못되었습니다.";
  206.  
  207.  
  208.   public static final Pattern EXPRESSION_PATTERN = Pattern.compile("^\\s*[-+]?[0-9]+\\s*[+*-]\\s*[-+]?[0-9]+\\s*$");
  209.   //BigInteger member state
  210.   private int[] data;
  211.   private int length;
  212.  
  213.  
  214.   // BinInteger Constructor
  215.   public BigInteger(int i)
  216.   {
  217.     length=lengthOf(i);
  218.     data = new int[length];
  219.     for(int j=0; j<length; j++)
  220.     {
  221.       data[j]=i%10;
  222.       i/=10;
  223.     }
  224.   }
  225.  
  226.  
  227.   public BigInteger(int[] num1)
  228.   {
  229.     length=num1.length;
  230.     data = new int[length];
  231.     System.arraycopy(num1, 0, data, 0, length);
  232.   }
  233.  
  234.  
  235.   public BigInteger(String s)
  236.   {
  237.     int sign = 1;
  238.     switch(s.charAt(0))
  239.     {
  240.       case '-':
  241.         sign = -1;
  242.       case '+':
  243.         length = s.length()-1;
  244.         data = new int[length];
  245.         for(int i = 0; i < length ; i++)
  246.         {
  247.           data[i] = sign * Character.getNumericValue(s.charAt(length-i));
  248.         }
  249.         break;
  250.       default:
  251.         length = s.length();
  252.         data = new int[length];
  253.         for(int i =0 ; i<length; i++)
  254.         {
  255.           data[i] = Character.getNumericValue(s.charAt(length-i-1));
  256.         }
  257.  
  258.     }
  259.   }
  260.  
  261.   //BigInteger Method
  262.  
  263.   public BigInteger add(BigInteger big)
  264.   {
  265.     int[] resultData = new int[((this.length>big.length)? this.length : big.length)+1];
  266.  
  267.     //add digit by digit
  268.     for(int i = 0 ; i<this.length ; i++)
  269.       resultData[i] = this.data[i];
  270.     for(int i = 0 ; i<big.length; i++)
  271.       resultData[i] += big.data[i];
  272.  
  273.  
  274.     //handling CarryIn
  275.     resultData = handlingCarryIn(resultData);
  276.     resultData = deleteZero(resultData);
  277.  
  278.  
  279.     //digit sign correction
  280.     resultData = correctDigitSign(resultData);
  281.     resultData = deleteZero(resultData);
  282.  
  283.  
  284.     return new BigInteger(resultData);
  285.  
  286.   }
  287.  
  288.  
  289.   public BigInteger subtract(BigInteger big)
  290.   {
  291.  
  292.     return this.add(big.multiply(new BigInteger(-1)));
  293.   }
  294.  
  295.  
  296.   public BigInteger multiply(BigInteger big)
  297.   {
  298.     int[] resultData = new int[this.length+big.length];
  299.  
  300.     //multiply
  301.     for(int i = 0 ; i<big.length; i++)
  302.     {
  303.       for(int j = 0; j<this.length; j++)
  304.       {
  305.         resultData[i+j]+=this.data[j] * big.data[i];
  306.  
  307.       }
  308.     }
  309.  
  310.     //Handling CarryIn
  311.     resultData = handlingCarryIn(resultData);
  312.     resultData = deleteZero(resultData);
  313.  
  314.     return new BigInteger(resultData);
  315.  
  316.   }
  317.  
  318.   //@Override
  319.   public String toString()
  320.   {
  321.     String result = "";
  322.     result = result + data[length-1];
  323.     for(int i = 1 ; i < length ; i++)
  324.       result = result + Math.abs(data[length-1-i]);
  325.  
  326.     return result;
  327.  
  328.   }
  329.  
  330.  
  331.   static BigInteger evaluate(String input) throws IllegalArgumentException
  332.   {
  333.     //Check validity
  334.     if(!isValid(input))
  335.       throw new IllegalArgumentException();
  336.     //parse input and store parsed data at lhs, operator,rhs
  337.     String lhs = parseOperand(input);
  338.     input = deleteFirstAndTrim(input, lhs);//if we parsed lhs, delete lhs from input
  339.     lhs = deleteZero(lhs);
  340.     char operator = input.charAt(0);
  341.     input = deleteFirstAndTrim(input, "[-+*]");
  342.  
  343.     String rhs = parseOperand(input);
  344.     rhs = deleteZero(rhs);
  345.  
  346.     //make bigInteger Instance by parsed String and evaluate
  347.     BigInteger num1 = new BigInteger(lhs);
  348.     BigInteger num2 = new BigInteger(rhs);
  349.     BigInteger result = evaluateResult(num1, operator, num2);
  350.  
  351.     return result;
  352.    
  353.   }
  354.  
  355.  
  356.   public static void main(String[] args) throws Exception
  357.   {
  358.     try (InputStreamReader isr = new InputStreamReader(System.in))
  359.     {
  360.  
  361.       try (BufferedReader reader = new BufferedReader(isr))
  362.       {
  363.         boolean done = false;
  364.         while (!done)
  365.         {
  366.           String input = reader.readLine();
  367.           try
  368.           {
  369.             done = processInput(input);
  370.  
  371.           }
  372.           catch (IllegalArgumentException e)
  373.           {
  374.             System.err.println(MSG_INVALID_INPUT);
  375.           }
  376.         }
  377.       }
  378.     }
  379.   }
  380.  
  381.  
  382.   static boolean processInput(String input) throws IllegalArgumentException
  383.   {
  384.     boolean quit = isQuitCmd(input);
  385.     if (quit)
  386.     {
  387.       return true;
  388.     }
  389.     else
  390.     {
  391.       BigInteger result = evaluate(input);
  392.       System.out.println(result.toString());
  393.       return false;
  394.  
  395.     }
  396.   }
  397.  
  398.  
  399.   static boolean isQuitCmd(String input)
  400.   {
  401.     return input.equalsIgnoreCase(QUIT_COMMAND);
  402.  
  403.   }
  404.  
  405.   //check validity
  406.   static boolean isValid(String input)
  407.   {
  408.     Matcher m = EXPRESSION_PATTERN.matcher(input);
  409.     return m.find();
  410.  
  411.   }
  412.  
  413.   //get rid of the first 'delete' from the target and trim.
  414.   static String deleteFirstAndTrim(String target, String delete)
  415.   {
  416.     if(delete.charAt(0)=='+')
  417.       delete="\\"+delete; //for regex started with +
  418.     target=target.replaceFirst(delete, "");
  419.     target=target.trim();
  420.     return target;
  421.  
  422.   }
  423.  
  424.   //Operand Parser
  425.   static String parseOperand(String input)
  426.   {
  427.  
  428.     Pattern p = Pattern.compile("[+-]?[0-9]+");
  429.     Matcher m = p.matcher(input);
  430.     m.find();
  431.  
  432.     return m.group();
  433.  
  434.   }
  435.  
  436.   //Selection Method
  437.   static BigInteger evaluateResult(BigInteger lhs, char op, BigInteger rhs) throws IllegalArgumentException
  438.   {
  439.     switch(op)
  440.     {
  441.       case '+':
  442.         return lhs.add(rhs);
  443.  
  444.       case '-':
  445.         return lhs.subtract(rhs);
  446.  
  447.       case '*':
  448.         return lhs.multiply(rhs);
  449.       default:
  450.         throw new IllegalArgumentException();
  451.     }
  452.   }
  453.  
  454.  
  455.   static int lengthOf(int i)
  456.   {
  457.     int result = 1;
  458.     boolean done = false;
  459.     while(!done)
  460.     {
  461.       if(i/10!=0)
  462.       {
  463.         result++;
  464.         i=i/10;
  465.         continue;
  466.       }
  467.       else break;
  468.     }
  469.     return result;
  470.  
  471.   }
  472.  
  473.   static boolean isSign(char c)
  474.   {
  475.     return (c=='+'||c=='-');
  476.  
  477.   }
  478.  
  479.   //delete meaningless Zero
  480.   static String deleteZero(String input)
  481.   {
  482.     int index = 0;
  483.     if(isSign(input.charAt(0)))
  484.       index++;
  485.  
  486.     while(input.charAt(index)=='0'&&index!=input.length()-1)
  487.     {
  488.  
  489.       input=input.replaceFirst("0", "");
  490.  
  491.     }
  492.     return input;
  493.  
  494.   }
  495.  
  496.  
  497.   static int[] deleteZero(int[] input)
  498.   {
  499.     int count = 0;
  500.     int index = input.length-1;
  501.     while(input[index]==0&&index!=0)
  502.     {
  503.       count++;
  504.       index--;
  505.     }
  506.     int[] result = new int[input.length-count];
  507.     System.arraycopy(input, 0, result, 0, result.length);
  508.  
  509.     return result;
  510.  
  511.   }
  512.  
  513.  
  514.   static int[] handlingCarryIn(int[] input)
  515.   {
  516.     for(int i = 0 ; i<input.length-1; i++)
  517.     {
  518.       if(input[i]/10!=0)
  519.       {
  520.         input[i+1]+=input[i]/10;
  521.         input[i]%=10;
  522.       }
  523.     }
  524.     return input;
  525.  
  526.   }
  527.  
  528.  
  529.   static int[] correctDigitSign(int[] input)
  530.   {
  531.     int sign = (input[input.length-1]>0 ? 1 : -1);
  532.  
  533.     for(int i = input.length-2 ; i>=0; i--)
  534.     {
  535.       if(input[i]*sign<0)
  536.       {
  537.         input[i+1]-=sign;
  538.         input[i]+=sign*10;
  539.       }
  540.     }
  541.     return input;
  542.  
  543.   }
  544.  
  545. }
  546.  
  547. //PART REPOST, TEH_TRANSISTOR
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement