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.|

CP306 - Math5

Өгсөн 3 оронтой тооны аравт ба зуутын орны цифрүүдийн аль их болохыг тогтоо. Хэрэв аравтын цифр их бол ARAVT, зуутын цифр их бол ZUUT гэж хэвлэ.

Input

Гурван оронтой нэг бүхэл тоо өгөгдөнө. Аравт болон зуутын оронгийн цифрүүд нь ялгаатай тоо өгөгдөнө.

Output

ARAVT, ZUUT гэсэн үр дүнгүүдийн нэгийг хэвлэнэ.

Example

Input:
526

Output:
ZUUT

Нэмсэн:munkhbat
Огноо:2015-03-09
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:Бүгд дараах хэлүүдээс бусад: ASM64 NCSHARP JS-MONKEY JULIA PYPY3

hide comments
2024-11-20 09:33:04
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
string s;
cin>>s;
if(next_permutation(s.begin(),s.end()))
cout<<s<<endl;
else
cout<<"no answer"<<endl;
}
return 0;
} //wxrd
2024-11-20 09:32:27
#include <bits/stdc++.h>
using namespace std;

int main() {
int n;
cin >> n;
vector<int> c(n);
for (int i=0;i<n;i++) {
cin>>c[i];
}

int j=0;
int p=0;

while (p<n-1) {
if (p+2<n && c[p+2]==0) {
p+=2;
} else {
p+=1;
}
j++;
}

cout<<j<<endl;

return 0;
}
uulendeeguurharaagch

Last edit: 2024-11-20 09:33:00
2024-08-16 09:37:10
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while (t--) {
long long n;
cin>>n;
long long s=n-1;
long long l=n+1;
while (true) {
long long P=l;
string o;
while (P > 0) {
o+=to_string(P%8);
P/=8;
}
string r=o;
reverse(r.begin(), r.end());
if (o == r) {
cout<<l<<endl;
break;
}
P=s;
o.clear();
while (P > 0) {
o+=to_string(P % 8);
P/=8;
}
r=o;
reverse(r.begin(), r.end());
if (o == r) {
cout<<s<<endl;
break;
}
l++;
s--;
}
}
return 0;
}
2024-08-09 10:40:14
#include<bits/stdc++.h>
using namespace std;
int a[5];
int b[14];
int main()
{
for(int i=1;i<6;i++)
cin>>a[i];
int s,r,t,q;
sort(a+1,a+6);
t=a[1];
int ok=0;
for(int i=2;i<=5;i++)
{
if(t==a[i]-1) t=a[i];
else {
ok=1;
break;
}
} //1 3 5 3 5
for(int i=1;i<=5;i++)
b[a[i]]++;

for(int i=1;i<=13;i++)
cout<<b[i]<<" ";
cout<<endl;
s=0,r=0,q=0,t=0;
for(int i=1;i<=13;i++)
{
if(b[i]==2) s++;
if(b[i]==3) r++;
if(b[i]==1) q++;
if(b[i]==4) t++;
}
if(ok==0) { cout<<"Straight"; return 0;}
if(s==2 and r==0) { cout<<"Two Pairs"; return 0;}
if(s==1 and r==1) { cout<<"Full House"; return 0;}
if(t==1) { cout<<"Four of a Kind"; return 0;}
if(r==1 and s==0) { cout<<"Three of a Kind"; return 0;}
if(s==1 and r==0) { cout<<"One Pair"; return 0;}
if(q==5 ) { cout<<"Nothing"; return 0;}
cout<<"Impossible";
}
2024-08-09 10:28:53
#include <bits/stdc++.h>
using namespace std;
int a[6],b[14];
int main(){
int n,ok=0;
for(int i=1; i<=5; i++){
cin>>a[i];
}

sort(a+1,a+6);
n=a[1];
for(int i=2; i<=5; i++){
if(n==a[i]-1) n=a[i];
else {
ok=1;
break;
}

}
int one=0, two=0,three=0,four=0,s=0;
for(int i=1; i<=5; i++) b[a[i]]++;
// for(int i=1;i<=13;i++)
for(int i=1;i<=13;i++)
{
if(b[i]==2) two++;
if(b[i]==3) three++;
if(b[i]==4) four++;
if(b[i]==1) one++;
}

if(ok==0){cout<<"Straight";return 0;}
if(four==1 and one==1){cout<<"Four of a Kind";return 0;}
if(three==1 and two==1){cout<<"Full House";return 0;}
if(two==2){cout<<"Two Pairs";return 0;}
if(one==5){cout<<"Nothing";return 0;}
if(two==1 and one==3 ){cout<<"One Pair";return 0;}
else cout<<"Impossible";
}
2024-08-08 09:23:07
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<int> c(5);
for (int i = 0; i < 5; ++i) {
cin >> c[i];
}
map<int, int> s;
for (int x : c) {
s[x]++;
}
int p_count = 0, t_count = 0, r_count = 0;
for (auto& count : s) {
if (count.second == 4) r_count++;
if (count.second == 3) t_count++;
if (count.second == 2) p_count++;
}
if (r_count == 1) {
cout << "Four of a Kind" << endl;
return 0;
}
if (t_count == 1 && p_count == 1) {
cout << "Full House" << endl;
return 0;
}
if (t_count == 1) {
cout << "Three of a Kind" << endl;
return 0;
}
if (p_count == 2) {
cout << "Two Pairs" << endl;
return 0;
}
if (p_count == 1) {
cout << "One Pair" << endl;
return 0;
}
sort(c.begin(), c.end());
bool ht = true;
for (int i = 1; i < 5; i++) {
if (c[i] != c[i - 1] + 1) {
ht = false;
break;
}
}
if (c == vector<int>{1, 10, 11, 12, 13}) ht = true;

if (ht) {
cout << "Straight" << endl;
return 0;
}
if (s.size() == 5) {
cout << "Nothing" << endl;
return 0;
}
cout << "Impossible" << endl;
return 0;
}
2024-01-22 06:43:17
#include <bits/stdc++.h>
int main(){
int i,j,n,t=1;
scanf("%d",&n);
int a[n][n];
for (i=0;i<n;i++){
if(i%2==0){
for(j=0;j<n;j++){
a[i][j]=t;
t++;
}
}
else{
for(j=n-1;j>=0;j--){
a[i][j]=t;
t++;
}

}
}
for (i=0;i<n;i++){
for(j=0;j<n;j++){
printf("%3d",a[i][j]);
}
printf("\n");
}

return 0;
}
2024-01-22 06:35:35
#include <bits/stdc++.h>
using namespace std;
int main(){
int t,s = 0, n = 0;
cin >> t;
int jin[t];
for (int i = 0; i < t; i++) {
cin >> jin[i]; }
int b = INT_MAX ;
for (int i = 0; i < pow(2, t); i++) {
int s = 0;
int n = 0;
for (int j=0; j<t; j++) {
if ((i>>j)&1) { s=s+jin[j]; }
else { n= n+jin[j]; }
}
int z=abs(s-n);
b=min(b,z);
}
cout<<b;
return 0;
}
2024-01-22 05:15:03
#include <bits/stdc++.h>
using namespace std;
int a[21];
int main()
{
int n,l;
cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]>>a[7]>>a[8]>>a[9]>>a[10]>>a[11]>>a[12]>>a[13]>>a[14]>>a[15]>>a[16]>>a[17]>>a[18]>>a[19]>>a[20];
cout<<a[20]<<" "<<a[11]<<endl;
cout<<a[19]<<" "<<a[10]<<endl;
cout<<a[18]<<" "<<a[9]<<endl;
cout<<a[17]<<" "<<a[8]<<endl;
cout<<a[16]<<" "<<a[7]<<endl;
cout<<a[15]<<" "<<a[6]<<endl;
cout<<a[14]<<" "<<a[5]<<endl;
cout<<a[13]<<" "<<a[4]<<endl;
cout<<a[12]<<" "<<a[3]<<endl;
cout<<a[11]<<" "<<a[2]<<endl;
cout<<a[10]<<" "<<a[1]<<endl;
}
2024-01-22 03:17:49
#include <bits/stdc++.h>
using namespace std;
struct point{
int x;
int y;
};
double zai(int x, int y, int x1,int y1)
{
return sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
}

int main() {
int n,b,c,d;
double z=-1,xl=0,xy=0;
cin>>n;
vector <point>v(n);
for(int i=0;i<n;i++)
{
cin>>v[i].x>>v[i].y;
}
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
{
z=max(z,zai(v[i].x,v[i].y,v[j].x,v[j].y));
}
printf("%.15f",z);
return 0;
}
Диаметрийг тохируулах
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.