paste bin
Author
Language
C++
Plain text
Accesslog
Action script
Ada
Apache
Arduino
Armasm
Autohotkey
Awk
Bash
Basic
Brainfuck
C
Clojure
Cmake
C#
css
D
Delphi
Dockerfile
Erlang
Fortran
F#
Gauss
Go
Gradle
Graphql
Groovy
Haskell
Ini
Java
JavaScript
json
Julia
Kotlin
Lasso
LaTeX
Leaf
lisp
llvm
Lua
Makefile
Markdown
Mathematica
Matlab
Nginx
Objective-C
Ocaml
Oxygene
Perl
PgSQL
php
Powershell
Processing
Profile
Properties
Puppet
Purebasic
Python
Q
QML
R
Ruby
Rust
Scala
Scheme
Scilab
Shell
Smalltalk
SQL
Swift
Typescript
VB.NET
VB Script
Verilog
Vim
Wasm
x86asm
Xml
Xquery
Yaml
source code:
#include <cstdio> #include <cstring> #define MAXN 10007 char isPrime[MAXN]; void init() { memset(isPrime,1,sizeof(isPrime)); isPrime[0]=0; isPrime[1]=0; int i,j; for(i=2;i*i<=MAXN;i++) { if(isPrime[i]==0) continue; for(j=i*i;j<MAXN;j+=i) isPrime[j]=0; } return ; } int mirror(int x) { int r=0; while (x>0) { r=r*10+x%10; x/=10; } return r; } int main(void) { init(); int i,lwbd,upbd,r; scanf("%d%d",&lwbd,&upbd); int counter=0; for(i=lwbd;i<=upbd;i++) { r=mirror(i); if(isPrime[i] && isPrime[r]) counter+=1; } printf("%d\n",counter); return 0; }
comment: