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-12-12 02:21:43
#include<iostream>
using namespace std;
int main()
{
long long a, b, c, d, j, h;
cin >> a;
for ( int i=1000 ; i<=9000 ; i++)
{
b=a+1;
d=b/1000;
c=b%10;
j=b%100/10;
h=b/100%10;
if (d!=c && d!=j && d!=h && c!=j && j!=h && h!=c)
{
cout << b;
return 0;
}
else
a=a+1;
}
}

uzegslentei on
2024-12-12 02:21:06
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a=3,n;
cin >> n;
if(n==1) {
cout << 1;
return 0;
}
if(n==2) {
cout << 3;
return 0;
}
if(n==3) {
cout << 7;
return 0;
}
while(n>a) {
n-=a;
a*=3;
}
a/=3;
while(1) {
if(n%3==0) {
n--;
if(n/a==0) cout << 1;
if(n/a==1) cout << 3;
if(n/a==2) cout << 7;
n++;
}
else {
if(n/a==0) cout << 1;
if(n/a==1) cout << 3;
if(n/a==2) cout << 7;
}
if(n%a==0) {
n=a;
}
else n%=a;
a/=3;
if(a==1) {
if(n%3==0) cout << 7;
if(n%3==1) cout << 1;
if(n%3==2) cout << 3;
return 0;
}
}
}

// too 1 3 7
2024-12-11 15:37:34
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin>>N;
int m[N][N];
int n=1;
int l=0;
while (n<=N*N) {
for (int i=l; i<N-l;++i) {
m[l][i]=n++;
}
for (int i=l+1;i<N-l;++i) {
m[i][N-l- 1]=n++;
}
for (int i=N-l-2;i>=l;--i) {
m[N-l-1][i]=n++;
}
for (int i=N-l-2;i>l;--i) {
m[i][l]=n++;
}
l++;
}
for (int i=0;i<N;++i) {
for (int j=0;j<N;++j) {
cout<<setw(4)<<m[i][j];
}
cout<<endl;
}
return 0;
}
2024-12-11 07:16:19
#include <bits/stdc++.h>
using namespace std;
#define ll long unsigned int
int sm, teg, neg, hoy, gur, dor, tav, zur , dol, nai, yos;
map <string, int> mp;
vector <int> v;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
string s;
ll n, k, l;
cin >> n;
ll n1 = n;
while(n1 != 0)
{
k = n1 % 10;
sm++;
n1 /= 10;
}
ll m = pow(10, sm) - 1;
for(ll i = n + 1; i <= m; i++){
s += to_string(i);
}
for(ll i = 0; i < s.size(); i++)
{
if(s[i] == '1') neg++;
if(s[i] == '2') hoy++;
if(s[i] == '3') gur++;
if(s[i] == '4') dor++;
if(s[i] == '5') tav++;
if(s[i] == '6') zur++;
if(s[i] == '7') dol++;
if(s[i] == '8') nai++;
if(s[i] == '0') teg++;
if(s[i] == '9') yos++;
}
cout << teg << " " << neg << " " << hoy << " " << gur << " " << dor << " " << tav << " " << zur << " " << dol << " " << nai << " " << yos;
}
//Tse Ku
2024-12-11 07:00:45
#include <bits/stdc++.h>
using namespace std;
#define ll long unsigned int
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll n;
cin >> n;
ll t = n, sm = 0;
while (t) {
sm++;
t /= 10;
}

ll m = pow(10, sm);

int oron[10] = {0};

for (ll i = n + 1; i < m; i++) {
ll c = i;
while (c) {
oron[c % 10]++;
c /= 10;
}
}

for (int i = 0; i < 10; i++) {
cout << oron[i] << " ";
}
return 0;
}
2024-12-10 16:07:50
#include<bits/stdc++.h>
using namespace std;

int main() {
string b;
cin >> b;

long long d = 0;

int length = b.length();
for (int i = 0; i < length; i++) {
if (b[length - i - 1] == '1') {
d += (1LL << i);
}
}

if (d % 15 == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}

return 0;
}
2024-12-10 03:46:43
#include <bits/stdc++.h>
using namespace std;
int main() {
int N,K,Q;
cin>>N>>K>>Q;
vector<int> a(N);
for (int i=0;i<N;i++) {
cin>>a[i];
}
vector<string> b(Q);
vector<int> c(Q);
for (int i=0;i<Q;i++) {
cin>>b[i]>>c[i];
}
for (int i=0;i<Q;i++) {
int t=0,s=0,k=0;
if (b[i]=="IH") {
for (int j=0;j<N;j++) {
if (c[i]<a[j]) {
t++;
}
}
cout<<t<<endl;
}
if (b[i]=="BAGA") {
for (int j=0;j<N;j++) {
if (c[i]>a[j]) {
s++;
}
}
cout<<s<<endl;
}
if (b[i]=="TENTSUU") {
for (int j=0;j<N;j++) {
if (c[i]==a[j]) {
k++;
}
}
cout<<k<<endl;
}
}
return 0;
}
2024-12-09 09:36:50
#include <bits/stdc++.h>
using namespace std;

int main() {
int n;
cin>>n;
vector<string> ug(n);
for (int i=0; i<n; ++i) cin>>ug[i];
for (int i=0; i<n; ++i) {
string r=ug[i], e="";
for (int j=0; j<r.size(); ++j) {
char c=r[j];
if (c=='a'||c=='b'||c=='c') e+='2';
else if (c=='d'||c=='e'||c=='f') e+='3';
else if (c=='g'||c=='h') e+='4';
else if (c=='i'||c=='j') e+='1';
else if (c=='k'||c=='l') e+='5';
else if (c=='m'||c=='n') e+='6';
else if (c=='o') e+='0';
else if (c=='p'||c=='r'||c=='s') e+='7';
else if (c=='t'||c=='u'||c=='v') e+='8';
else if (c=='w'||c=='x'||c=='y') e+='9';
else if (c=='z') e+='0';
}
cout<<e<<endl;
}
return 0;
}
2024-12-09 09:24:10
#include <iostream>
using namespace std;

int main() {
int R, B;
cin >> R >> B;

for (int L = 1; L <= 5000; ++L) {
for (int W = L; W <= 5000; ++W) {
if (2 * L + 2 * W - 4 == R) {
if (L * W - (2 * L + 2 * W - 4) == B) {
cout << max(L, W) << " " << min(L, W) << endl;
return 0;
}
}
}
}

return 0;
}
2024-12-09 05:52:20
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n,m,k,c;
cin>>n>>m>>k>>c;
if (k<c){
cout<<"0";
return 0;
}
ll a=m*(n/k);
a+=(n%k)*(m/k);
ll x=1,y=c;
while(x<=(n%k)) {
if(y>=1 && y<=(m%k)) {
a++;
}
x++;
y--;
if(y==0) {
y+=(k-1);
}
}
cout<<a;
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.