e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

"Mirror prime" numbers

published at 3/2/20, 5:46:20 pm

Sade eded hissesinde nezere alin ki, 1 sade eded deyil. Eks halda 20% numuneler sehv olacaq. Yoxlama ucun bezi numuneler:

Giris: 1 2 Cixis: 1

Giris: 1 100 Cixis: 13

Giris: 10 99 Cixis: 9

published at 3/23/20, 4:01:23 pm

x, y = [int(x) for x in input().split()] count1=0 count = 0 if 1<=x<= y<=10000: for val in range(x, y + 1): if val > 1: for n in range(2, val): if (val % n) == 0: break else:

            #print(val)
            value = int(str(val)[::-1])

            count +=1

            if value % 2 == 0 or value % 3 == 0 or value % 4 == 0 or value % 5 == 0 or value % 6 == 0 or value % 7 == 0 or value % 8 == 0 or value % 9 == 0:

                count1 += 1

if count==0: pass else: print(count-count1)

published at 3/24/20, 2:36:49 pm

Сначала подумал, что нужно найти количество таких пар, но всё оказалось намного проще...

published at 6/30/20, 3:38:43 pm

include <bits/stdc++.h>

using namespace std;

int main(int argc, char** argv) { int a,b,n,re,ans=2,anss=2,cav=0; cin>>a>>b; if(a==1){ a++; } else if(b==1){ b--; } for(int i=a;i<=b;i++){ n=i; stringstream ss; ss << n; string s = ss.str(); reverse(s.begin(),s.end()); //cout<<s<<endl;// stringstream geek(s); geek >> re; //cout<<re<<' '<<i<<endl;// for(int j=2;j<i;j++){ if(ans>2){ break; } if(i%j==0){ ans++; } } for(int j=2;j<re;j++){ if(anss>2){ break; } if(re%j==0){ anss++; } } //cout<<ans<<' '<<anss<<endl;// if(ans==2 and anss==2){ cav++; } ans=2;anss=2; } cout<<cav; return 0; }