Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

SSAM019A - CHIA HẾT CHO 2

 

Cho số nguyên dương N.

Nhiệm vụ của bạn là hãy xác định xem có bao nhiêu ước số của N chia hết cho 2?

Input: Dòng đầu tiên là số lượng bộ test T (T ≤ 100).

Mỗi bộ test gồm một số nguyên N (1 ≤ N ≤ 10^9)

Output:  Với mỗi test, in ra đáp án tìm được trên một dòng. 

Ví dụ:

Input 

Output

2

9

8

0

3


 

 


Được gửi lên bởi:adm
Ngày:2019-07-12
Thời gian chạy:1s
Giới hạn mã nguồn:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:ASM32-GCC ASM32 ASM64 MAWK BC C CSHARP C++ 4.3.2 CPP CPP14 COFFEE LISP sbcl DART FORTH GO JAVA JS-RHINO JS-MONKEY KTLN OCT PAS-GPC PAS-FPC PERL6 PERL PROLOG PYTHON PYTHON3 PY_NBC R RACKET SQLITE SWIFT UNLAMBDA

hide comments
2019-10-26 12:03:39
#include<iostream>
#include<algorithm>
using namespace std;

void nhap(int a[],int n){
for(int i=0;i<n;i++)
cin>>a[i];
}

void hienThi(int a[],int n){
for(int i=0;i<n;i++)
cout<<a[i]<<" ";
cout<<endl;
}
int main(){
int n=11;
for(int x=0;x<10;x++){
int a[101]={};
int c;
cin>>c;
nhap(a,n);
/*int a = *max_element(a,a+n);
int b = *min_element(a,a+n);
*/ hienThi(a,n);
while(c--){
int vtMax=0,vtMin=0,maxx=a[0],minn=a[0];
for(int i=0;i<n;i++){
if(a[i]>maxx){
maxx=a[i];
vtMax=i;
}
if(a[i]<minn){
minn=a[i];
vtMin=i;
}
}
a[vtMax]--;
a[vtMin]++;
hienThi(a,n);
}

}
//chu y th cac cot = nhau
//1 2 3 4 5 6 100 400 50 10 11
return 0;
}
2019-10-26 12:00:40


Steve, who is lazy and an expert of petty tricks, is annoyed of having to memorize the passwords. He may carry a memo, but it may be exposed to others. So, he thought of an idea.



He will create a password with the remaining numbers after removing the pairs of same numbers from a number string consisting of numbers 0~9. After removing the same number pairs, he can also remove the number pairs whose right and left numbers are the same. Following example shows the password from a number string after removing the applicable number pairs.
[Input]

The first line of the input file provides the length of the test case. The next line contains the number character string without a space.

The character string consists of numbers between 0~9. The length of the character string N 10≤N≤100. The length of the password is smaller than the length of the character string.





[Output]

Each of 10 lines of the output file contains the answer (password) to each of 10 test cases. Each line begins with ‘#x’ followed by a space and then the answer. Here, x is the test case number.





[Input Example]

10 1238099084
16 4100112380990844

...













[Output Example]

#1 1234
#2 4123

...
2019-10-26 12:00:01
[Problem]

Create a program which converts a character string of calculation formula to a postfix expression and calculates it.



For example, a character string “3+4+5+6+7” can be converted to a postfix expression "34+5+6+7+".

The calculation should yield 25.

The operator used in the formula is ‘+’ only, and the operands are the integers between 0 ~ 9.





[Input]

The first line of the input file provides the length of the test case. The test cases are given in the next lines. Total of 10 test cases are given.







[Output]

The output file outputs the test case number following the ‘#’ symbol. It is followed by a space, and then the answer.



[Input Example]

101

9+8+5+9+2+4+1+8+3+9+3+8+7+8+6+8+9+4+1+1+7+6+1+5+8+7+6+9+6+3+1+3+1+7+5+9+2+8+4+3+7+3+4+7+3+4+8+3+2+6+6

83

7+4+8+3+4+8+5+5+3+6+7+1+2+5+6+5+5+6+1+6+7+8+6+4+7+4+3+1+6+1+2+1+6+8+6+9+2+7+4+3+2+3

...














[Output Example]

#1 267

#2 197

...
2019-10-26 11:59:36
[Question]

A palindrome is a word, phrase, verse, or sentence that reads the same backward or forwardlike “level” or “radar”.



Create a program which inspects the vertical and horizontal lines of a 100x100 character matrix and returns the length of the longest palindrome.
In the above example, the longest palindrome is marked in red box and consists of 7 characters. Therefore, the program should return 7. It should be noted that the above example is the case of 8x8 matrix just for explanation, but the program should deal with 100x100 matrix.





[Constraints]

The character in each block is the char type in c language and can be ‘A’, ‘B’ or ‘C’.

The character matrix is a square.

ABA and ABBA are both palindromes. A is also a palindrome with the length of 1 character.

Only the vertical and horizontal lines should be evaluated. In the following example, the word in yellow blocks would a palindrome with the length of 7 characters. However, it would not be accepted, because it is not a straight line.
[Input]

The first line of the input file provides the length of the palindrome to search for. The test case is given in next lines.

Total of 10 test cases are given.





[Output]

The output file outputs the test case number following the ‘#’ symbol. It is followed by a space, and then the length of the longest palindrome.





[Input Example]

1

CCBBCBAABCCCBABCBCAAAACABBACCCCACAABCBBACACAACABCBCCB...

ACBAAAACCACCCBAACAAABACACCABCBCBABBBACBABCAACCBCCACBC...

CCCACCBCBACBACBCABAABABCCAAAACCCCCBBAABBCCBCCCABBACAC...

CABACBCBBCBABACABBBBBBABBCABCBCBCAABCBCCCBABACCCCABBA...

BCCBCCACCBCBCABBBCCABAACACCBCCCBCCACCBBCBCCCBBCCBACBC...

BBBBCBBAACABACCBCBCCABBBBCCAABCBBCACCBBCAAAABABABBABB...

ABBAACCCACBBABBABCCCABABCACABABACCCBACACABCBCCCBABCCC...

ABBBBAABCAACCBACBBAACACABCABACBAABCAABBCCCCCCACBCCCCA...

ACCACABABBACBBAACCBBACBBCCACCACCABCCBABABBBACBACBAABC...

BABACACCABCAACBAABCCACCACBCCAABBCBAABABAACAAAAAACCCBC...

...

2

CBBABBACCAACCCAABABAACCABCBBCCABABBBBBCCACBCCCCBBBAAC...

BBBCBACAAABAACACBCAABBAAABCABBBCAAACBAABCAAAAACBABBAB...

CAAAABCAABAACCBBABCCCACABABACBCCBCCBABABBCCCBCBACAAAC...

BBBACBBBBBAACBBCBABBCBAABACCCBBBBCCCBBBCABCABCAABCBCA...

ABBBBAABCBACCACBBCBBAABABCBCCAAABBCAAABBAABBCACABAABA...

ABCBACAAACCCAAABCACABBAABBCAACCBABCCACBABBBABAABAACBB...

ACACABCBAAACCACABABBCABCBABAAABCBCCABABCCAACACBCBABCA...

ACCBACACCAAAABABACABABBBBABBAABABBBBACBACABABACACACAA...

AAACCCCCBCAACCCCCAAAACBCACBBABBBBBABABBCCCCBBAACCBBCB...

CCABCCBBCAAAACACBBBBAAAACABACABCCCBACBABBACCAABAAACAB...

...



[Output Example]

#1 18

#2 17

...
2019-10-26 11:13:12
#include<iostream>
#include<string>
using namespace std;


int main(){
freopen("GNS_test_input.txt", "r", stdin);
int x;
cin>>x;
cin.ignore();
for(int k=0;k<x;k++){
int dem=0;
int b[10001]={};
string a;
cin>>a;
int so;
cin>>so;
cin.ignore();

string c;
getline(cin,c);

string s="";

c[c.length()]=' ';
for(int i=0;i<=c.length();i++){
if(c[i]!=' '){
s+=c[i];
}
else{
//if(i==c.length())
//cout<<s<<endl;
if(s=="ZRO"){
b[dem]=0;
dem++;
}else if(s=="ONE"){
b[dem]=1;
dem++;
}
else if(s=="TWO"){
b[dem]=2;
dem++;
}
else if(s=="THR"){
b[dem]=3;
dem++;
}
else if(s=="FOR"){
b[dem]=4;
dem++;
}
else if(s=="FIV"){
b[dem]=5;
dem++;
}
else if(s=="SIX"){
b[dem]=6;
dem++;
}
else if(s=="SVN"){
b[dem]=7;
dem++;
}
else if(s=="EGT"){
b[dem]=8;
dem++;
}
else if(s=="NIN"){
b[dem]=9;
dem++;
}
s="";
}
}

for(int i=0;i<dem-1;i++){
for(int j=i+1;j<dem;j++){
if(b[i]>b[j]){
swap(b[i],b[j]);
}
}
}
cout<<"#"<<k+1<<" ";
for(int i=0;i<dem;i++){
switch (b[i]){
case 0:
cout<<"ZRO"<<" ";
break;
case 1:
cout<<"ONE"<<" ";
break;
case 2:
cout<<"TWO"<<" ";
break;
case 3:
cout<<"THR"<<" ";
break;
case 4:
cout<<"FOR"<<" ";
break;
case 5:
cout<<"FIV"<<" ";
break;
case 6:
cout<<"SIX"<<" ";
break;
case 7:
cout<<"SVN"<<" ";
break;
case 8:
cout<<"EGT"<<" ";
break;
case 9:
cout<<"NIN"<<" ";
break;
}
}
cout<<endl;
}
system("pause");
return 0;
}
2019-10-26 11:11:36
Flatten
Yellow boxes are stacked against a wall. Flattening is a task of reducing the gap between the tallest column and shortest column by moving the boxes on the taller column to the shorter column. After the flattening is completed, the height difference between the tallest column and shortest column should be no more than one box.

Create a program returning the height difference between the tallest column and shortest column after moving the boxes for flattening for the given number of times when there is a limit on the number of tasks of moving the boxes.
The task of moving a box from the tallest column to the shortest column is defined as ‘dump’. The diagram below shows the result of performing one dump from the diagram above.
A box in the column A was moved to the column B. It is acceptable to move the box in the column A’ instead of the column A
The diagram below shows the result of two dumps.
A box in the column A’ was moved to the column C. It is acceptable to move the box to the column C’ instead of the column C.



After two dumps, the height difference between the tallest column and shortest column is 8 -2 = 6. (It was 9 -1 = 8 before the first dump.)



If the number of dumps is limited to 2, the program should return 6.



[Constraints]

The width length is always 100.

All columns have the height of 1 ~ 100.

The dump count can be 1 ~ 1000.

No more dumps can be executed if flattening is completed within the given dump count. Therefore, the height difference between the tallest column and shortest column should be returned. (It can be 0 or 1 depending on the data.)



[Input]

The first line of the input file provides the number of dumps. The test case is given in next lines.

Total of 10 test cases are given.



[Output]

The output file outputs the test case number following the ‘#’ symbol. It is followed by a space, and then the height difference between the tallest column and shortest column in the test case is output.


© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.