pastebin
Add a new paste
View all pastes
Change language
Dutch
English
French
Russian
menu
URL Shortener
Multiple URL shortener
browser info
Whois IP and domain lookup
Capture a Website screenshot
Disqus Chatroom
Registration
Paste Search Dynamic
Recent pastes
Combo
8 hours ago
Mollybrooke Chaturbate Newmoll
8 hours ago
オニオンサイト2021
9 hours ago
unordered_map
10 hours ago
Free SOCKS5 proxy list
10 hours ago
math.sqrt
10 hours ago
Sport IPTV M3U playlist
10 hours ago
[Wordfence Alert] Admin Login
10 hours ago
Dark Web Sites 2021
10 hours ago
Fatal eUncaught PDOException:
10 hours ago
Counter
#include <stdio.h>
int
main
(
void
)
{
int
n;
scanf
(
"%d"
,&n
)
;
int
i,a,counter1=
0
,counter2=
0
,counter3=
0
,counter4=
0
,taxi=
0
;
for
(
i=
0
;i<n;i++
)
{
scanf
(
"%d"
,&a
)
;
if
(
a==
1
)
counter1++;
if
(
a==
2
)
counter2++;
if
(
a==
3
)
counter3++;
if
(
a==
4
)
counter4++;
}
printf
(
"Counter1 : %d Counter2 : %d Counter3 : %d Counter4 : %d
\n
"
,counter1,counter2,counter3,counter4
)
;
taxi+=counter4;
taxi+=counter3;
taxi+=
(
counter2/
2
)
;
counter2%=
2
;
if
(
counter3!=
0
)
{
if
(
counter1>counter3
)
{
counter1-=counter3;
counter3=
0
;
}
if
(
counter1==counter3
)
counter1=counter3=
0
;
if
(
counter1<counter3
)
counter1=counter3=
0
;
}
if
(
counter1>=
4
)
{
taxi+=
(
counter1/
4
)
;
counter1%=
4
;
}
if
(
counter1>
0
&& counter1<
4
)
{
if
(
counter2==
0
)
taxi++;
if
(
counter2!=
0
)
{
if
(
counter1==
3
)
taxi+=
2
;
else
taxi++;
}
}
if
(
counter1==
0
&& counter2!=
0
)
taxi++;
printf
(
"Counter1 : %d Counter2 : %d Counter3 : %d Counter4 : %d taxi : %d "
,counter1,counter2,counter3,counter4,taxi
)
;
return
0
;
}
Parsed in 0.012 seconds
Please enable JavaScript to view the
comments powered by Disqus.