Simple operation of nyoj-244-16 binary

Source: Internet
Author: User

Simple operation time limit for 16 binary: +Ms | Memory Limit:65535KB Difficulty:1
Describe
Now I'm going to give you a 16-in-a-plus-minus expression that requires the result of a 8-input expression.
Input
The
first line enters a positive integer T (0<t<100000)
Next there is t line, each line input a string s (length less than 15) string has two numbers and a plus or a minus, and the expression is legal and all operations are less than 31 bits
Output
Each expression output takes one row, and the result of the output expression 8 binary.
Sample input
329+482318be+67844ae1-3d6c
Sample output
441141001026565


Code:

#include <stdio.h> int main () {int T,x,y;char ch;scanf ("%d", &t), while (t--) {scanf ("%x%c%x", &x,&ch, &y), if (ch== ' + ') printf ("%o\n", x+y); elseprintf ("%o\n", X-y);} return 0;}

At first, the problem was complicated, and a string array was used to simulate the basic format type of the data to be converted!!!! The basic knowledge of C language is still need to strengthen!!!!

Simple operation of nyoj-244-16 binary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.