Pastebin
API
tools
faq
paste
Login
Sign up
SHARE
TWEET
AlexAvram
Untitled
AlexAvram
Nov 26th, 2022
91
0
Never
Add comment
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
C++
1.23 KB
| None
|
0
0
raw
download
clone
embed
print
report
#include <iostream>
#include <fstream>
#include <math.h>
using
namespace
std
;
ifstream f
(
"clatite.in"
)
;
ofstream g
(
"clatite.out"
)
;
bool
prim
(
int
a
)
{
if
(
(
a
%
2
==
0
&&
a
!
=
2
)
||
a
<
2
)
return
0
;
else
{
int
d
;
for
(
d
=
3
;
d
*
d
<=
a
;
d
+
=
2
)
if
(
a
%
d
==
0
)
return
0
;
}
return
1
;
}
bool
pp_cc
(
int
a
)
{
int
x, y
;
x
=
sqrt
(
a
)
;
if
(
x
*
x
==
a
)
return
1
;
y
=
cbrt
(
a
)
;
if
(
y
*
y
*
y
==
a
)
return
1
;
return
0
;
}
int
sumdiv
(
int
a
)
{
int
d
;
long
long
sum
=
0
;
for
(
d
=
1
;
d
*
d
<
a
;
++
d
)
if
(
a
%
d
==
0
)
sum
+
=
d
+
(
a
/
d
)
;
if
(
d
*
d
==
a
)
sum
+
=
d
;
return
sum
-
a
;
}
int
main
(
)
{
int
n, m
;
int
cioco
=
0
, gem
=
0
, inghe
=
0
, zah
=
0
, sim
=
0
;
f
>>
n
>>
m
;
if
(
n
>
m
)
swap
(
n,m
)
;
int
i, j
;
for
(
i
=
n
;
i
<=
m
;
++
i
)
{
if
(
prim
(
i
)
==
1
)
++
cioco
;
else
if
(
pp_cc
(
i
)
==
1
)
++
gem
;
else
if
(
sumdiv
(
i
)
==
i
)
++
inghe
;
else
if
(
i
%
2
==
0
)
++
zah
;
else
if
(
i
%
2
==
1
)
++
sim
;
}
g
<<
m
-
n
+
1
<<
'
\n
'
<<
cioco
<<
" "
<<
gem
<<
" "
<<
inghe
<<
" "
<<
zah
<<
" "
<<
sim
<<
'
\n
'
;
f.
close
(
)
;
g.
close
(
)
;
return
0
;
}
Advertisement
Add Comment
Please,
Sign In
to add comment
Public Pastes
Untitled
1 hour ago | 18.71 KB
JetsMinions Error
2 hours ago | 4.63 KB
Untitled
3 hours ago | 20.76 KB
Untitled
5 hours ago | 19.42 KB
hcl sort
Awk | 5 hours ago | 2.78 KB
Untitled
7 hours ago | 16.99 KB
Untitled
9 hours ago | 14.56 KB
py_PYTHON-FROM-CLI-RUN-HIDDEN-PYW
10 hours ago | 0.05 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!
AltStyle
によって変換されたページ
(->オリジナル)
/
アドレス:
モード:
デフォルト
音声ブラウザ
ルビ付き
配色反転
文字拡大
モバイル