submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s022996246
|
p00037
|
C++
|
#include<iostream>
main(){
cout << "«ã¤èÍz"<<endll;
}
|
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:4:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
4 | cout << "«ã¤èÍz"<<endll;
| ^~~~
| std::cout
In file included from a.cc:1:
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
63 | extern ostream cout; ///< Linked to standard output
| ^~~~
a.cc:4:27: error: 'endll' was not declared in this scope
4 | cout << "«ã¤èÍz"<<endll;
| ^~~~~
|
s667639230
|
p00037
|
C++
|
ツづ卍つーツつ「
|
a.cc:1:1: error: extended character 「 is not valid in an identifier
1 | ツづ卍つーツつ「
| ^
a.cc:1:1: error: '\U000030c4\U00003065\U0000534d\U00003064\U000030fc\U000030c4\U00003064\U0000300c' does not name a type
1 | ツづ卍つーツつ「
| ^~~~~~~~~~~~~~~~
|
s191251238
|
p00037
|
C++
|
#include<iostream>
#include<string>
using namespace std;
#define RIGHT 0
#define DOWN 1
#define LEFT 2
#define UP 3
int main(){
bool cross[5][5][4]; // x,y,dir
int px=0, py=0, dir = RIGHT;
int d[4][2] = {{1,0}, {0,1}, {-1,0}, {0,-1}};
string str;
memset( cross, 0, sizeof(cross) );
for( int i=0; i<4; i++ ){
getline( cin, str );
for( int j=0; j<4; j++ ){
cross[j][i][RIGHT] = cross[j+1][i][LEFT] = (str[j]=='1');
}
getline( cin, str );
for( int j=0; j<5; j++ ){
cross[j][i][DOWN] = cross[j][i+1][UP] = (str[j]=='1');
}
}
getline( cin, str );
for( int j=0; j<4; j++ ){
cross[j][4][RIGHT] = cross[j+1][4][LEFT] = (str[j]=='1');
}
do{
for( int i=0; i<4; i++ ){
if( cross[px][py][(dir+3+i)%4] ){
dir = (dir+3+i)%4;
px += d[dir][0];
py += d[dir][1];
// cout << (dir==RIGHT)?"R":((dir==DOWN)?"D":((dir==LEFT)?"L":"U"));
if( dir == RIGHT ){
cout << 'R';
}else if( dir == DOWN ){
cout << 'D';
}else if( dir == LEFT ){
cout << 'L';
}else if( dir == UP ){
cout << 'U';
}
break;
}
}
}while( px!=0 || py!=0 );
cout << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:9: error: 'memset' was not declared in this scope
15 | memset( cross, 0, sizeof(cross) );
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | #include<string>
|
s630772281
|
p00037
|
C++
|
}
else if(ex[vy][vx-1] == 1) {
vx--;
direction = 3;
cout << "L";
}
}
}
cout << endl;
}
|
a.cc:1:7: error: expected declaration before '}' token
1 | }
| ^
a.cc:2:7: error: expected unqualified-id before 'else'
2 | else if(ex[vy][vx-1] == 1) {
| ^~~~
a.cc:7:5: error: expected declaration before '}' token
7 | }
| ^
a.cc:8:3: error: expected declaration before '}' token
8 | }
| ^
a.cc:9:3: error: 'cout' does not name a type
9 | cout << endl;
| ^~~~
a.cc:10:1: error: expected declaration before '}' token
10 | }
| ^
|
s492552186
|
p00037
|
C++
|
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);i++)
void input(bool grid[][9])
{
rep(i,9){
string s;
cin>>s;
if(i%2==0)
rep(j,4)
grid[i][j*2+1]=s[j]-'0';
else
rep(j,5)a
grid[i][j*2]=s[j]-'0';
}
}
enum dir{
UP,RIGHT,DOWN,LEFT
};
const int di[]={-1,0,1,0};
const int dj[]={0,1,0,-1};
const char output[]="URDL";
bool in_range(int i,int j)
{
return 0<=i && i<9 && 0<=j && j<9;
}
int main()
{
bool grid[9][9]={{0}};
input(grid);
int i=0,j=0;
dir prev=RIGHT;
for(;;){
dir next[4]={LEFT,UP,RIGHT,DOWN};
rotate(next,next+prev,next+4);
int k;
for(k=0;k<3;k++){
if(in_range(i+di[next[k]],j+dj[next[k]]) && grid[i+di[next[k]]][j+dj[next[k]]])
break;
}
cout<<output[next[k]];
i+=di[next[k]]*2;
j+=dj[next[k]]*2;
prev=next[k];
if(i==0 && j==0)
break;
}
cout<<endl;
return 0;
}
|
a.cc: In function 'void input(bool (*)[9])':
a.cc:17:21: error: 'a' was not declared in this scope
17 | rep(j,5)a
| ^
|
s047129679
|
p00037
|
C++
|
#include <iostream>
#include <string>
using namespace std;
int a[12][12];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};
char dc[4] = {'R','D','L','U'};
//ツ篠ゥツ閉ェツづ個偲シツ暗債4ツマツスツづ個陛?づ個湘ウツ妥板づーツ陳イツづ猟づゥ
void cheakWall(int* wall , const int& px ,const int& py ,const int& d ){
for(int i=0 ; i<4 ; ++i ){
int mx = px + dx[(d+i)%4];
int my = py + dy[(d+i)%4];
wall[i] = a[my][mx];
}
}
//ツ進ツづアツつセツ古シツつォツづーツ記ツ録
void record(string& s,int* wall,const int d){
if( wall[1] ){
s.push_back( dc[d] );
}
}
//ツ進ツづ?void go(int& px, int& py, const int& d,int* wall, string& s){
px += dx[d]*2;
py += dy[d]*2;
record( s , wall , d );
}
int main(){
string s;
//ツ配ツ療アツづ個渉可甘コツ可サ
for(int y=0 ; y<12 ; ++y )
for(int x=0 ; x<12 ; ++x )
a[y][x] = 0;
//ツ禿シツ療? for(int i=0 ; i<9 ; ++i ){
cin >> s;
int y = i+1;
int x = (i+1)%2 + 1;
for(int j=0 ; j<(int)s.size() ; ++j , x+=2 ){
a[y][x] = s[j] - '0';
}
}
int px = 2, py = 0, d = 0;
bool flag = false;
s.clear();
while( 1 ){
if( px == 0 && py == 0 ) break;
int wall[4];
//ツ篠ゥツ閉ェツづ個偲シツづィツづ個湘ウツ妥? cheakWall( wall , px , py , d );
if( !wall[1] ){//ツ右ツつェツ陛?つカツづ。ツづ按つゥツづ?つスツづァ
//ツ古シツつォツづーツ右ツ古シツつォツづ可嘉アツづゥ
d = (d+1)%4;
//ツ進ツづ? go( px , py , d , wall , s );
flag = false;
}else{
if( !wall[0] ){//ツ前ツつェツ陛?つカツづ。ツづ按つゥツづ?つスツづァ
//ツ進ツづ? go( px , py , d , wall , s );
flag = false;
}else{
if( !wall[3] ){//ツ債カツつェツ陛?つカツづ。ツづ按つゥツづ?つスツづァ
if( flag == false ){
//ツ進ツづアツつセツ古シツつォツづーツ記ツ録
record( s , wall , d );
}
//ツ古シツつォツづーツ債カツ古シツつォツづ可嘉アツづゥ
d = (d+3)%4;
//ツ進ツづ? go( px , py , d , wall , s );
flag = false;
}else{//ツ前ツ・ツ右ツ・ツ債カツつェツ陛?つセツづ?つスツづァ
flag = true;
//ツ進ツづアツつセツ古シツつォツづーツ記ツ録
record( s , wall , d );
//ツ古シツつォツづーツ右ツ古シツつォツづ可嘉アツづゥ
d = (d+3)%4;
//ツ進ツづアツつセツ古シツつォツづーツ記ツ録
s.push_back( dc[d] );
}
}
}
}
cout << s << endl;
}
|
a.cc:27:5: error: 'px' does not name a type
27 | px += dx[d]*2;
| ^~
a.cc:28:5: error: 'py' does not name a type
28 | py += dy[d]*2;
| ^~
a.cc:29:11: error: expected constructor, destructor, or type conversion before '(' token
29 | record( s , wall , d );
| ^
a.cc:30:1: error: expected declaration before '}' token
30 | }
| ^
a.cc: In function 'int main()':
a.cc:42:17: error: 'i' was not declared in this scope
42 | int y = i+1;
| ^
a.cc: At global scope:
a.cc:51:5: error: 's' does not name a type
51 | s.clear();
| ^
a.cc:53:5: error: expected unqualified-id before 'while'
53 | while( 1 ){
| ^~~~~
a.cc:90:5: error: 'cout' does not name a type
90 | cout << s << endl;
| ^~~~
a.cc:91:1: error: expected declaration before '}' token
91 | }
| ^
|
s721091446
|
p00037
|
C++
|
#include <iostream>
#include <cstdio>
#define LEFT 0
#define UP 1
#define RIGHT 2
#define DOWN 3
#define MIN(X,Y) ((X<Y)?X:Y)
#define MAX(X,Y) ((X>Y)?X:Y)
bool map[5][5][5][5];
int direction=RIGHT;
int pos[2]={0,0};
char nul[5000];
void read(void)
{
for(int y=0;y<4;y++)
{
for(int x=0;x<4;x++)
map[x][y][x+1][y] = (getchar()-'0' == 1);
gets(nul);
for(int x=0;x<5;x++)
map[x][y][x][y+1] = (getchar()-'0' == 1);
gets(nul);
}
for(int x=0;x<4;x++)
map[x][4][x+1][4] = (getchar()-'0' == 1);
return;
}
bool isenable(int x, int y)
{
return ((0<=x)&&(x<=4))&&((0<=y)&&(y<=4));
}
bool isconnect(int dir)
{
int x=pos[0], y=pos[1];
switch(dir) {
case LEFT: x--;
break;
case UP: y--;
break;
case RIGHT: x++;
break;
case DOWN: y++;
break;
}
return (isenable(x,y)&&(map[MIN(pos[0],x)][MIN(pos[1],y)][MAX(pos[0],x)][MAX(pos[1],y)]));
}
void step(int dir)
{
switch(dir) {
case LEFT: pos[0]--; std::cout << "L" << std::flush; direction=LEFT;
break;
case UP: pos[1]--; std::cout << "U" << std::flush; direction=UP;
break;
case RIGHT: pos[0]++; std::cout << "R" << std::flush; direction=RIGHT;
break;
case DOWN: pos[1]++; std::cout << "D" << std::flush; direction=DOWN;
break;
}
return;
}
void move(void)
{
do {
if(isconnect((direction+LEFT-1+4)%4))
step((direction+LEFT-1+4)%4);
else if(isconnect((direction+UP-1+4)%4))
step((direction+UP-1+4)%4);
else if(isconnect((direction+RIGHT-1+4)%4))
step((direction+RIGHT-1+4)%4);
else
//std::cerr << "error" << std::endl;
//std::cerr << "(x,y):" << pos[0] << "," << pos[1] << std::endl;
}while(!(pos[0]==0 && pos[1]==0));
std::cout << std::endl;
return;
}
int main(void)
{
for(int i=0; i<5; i++)
for(int j=0; j<5; j++)
for(int k=0; j<5; j++)
for(int l=0; j<5; j++)
map[i][j][k][l] = false;
read();
move();
}
|
a.cc: In function 'void read()':
a.cc:24:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
24 | gets(nul);
| ^~~~
| getw
a.cc: In function 'void move()':
a.cc:82:9: error: expected primary-expression before '}' token
82 | }while(!(pos[0]==0 && pos[1]==0));
| ^
|
s552322790
|
p00037
|
C++
|
#include <iostream>
#include <cstdio>
#define LEFT 0
#define UP 1
#define RIGHT 2
#define DOWN 3
#define MIN(X,Y) ((X<Y)?X:Y)
#define MAX(X,Y) ((X>Y)?X:Y)
bool map[5][5][5][5];
int direction=RIGHT;
int pos[2]={0,0};
char nul[5000];
void read(void)
{
for(int y=0;y<4;y++)
{
for(int x=0;x<4;x++)
map[x][y][x+1][y] = (getchar()-'0' == 1);
gets(nul);
for(int x=0;x<5;x++)
map[x][y][x][y+1] = (getchar()-'0' == 1);
gets(nul);
}
for(int x=0;x<4;x++)
map[x][4][x+1][4] = (getchar()-'0' == 1);
return;
}
bool isenable(int x, int y)
{
return ((0<=x)&&(x<=4))&&((0<=y)&&(y<=4));
}
bool isconnect(int dir)
{
int x=pos[0], y=pos[1];
switch(dir) {
case LEFT: x--;
break;
case UP: y--;
break;
case RIGHT: x++;
break;
case DOWN: y++;
break;
}
return (isenable(x,y)&&(map[MIN(pos[0],x)][MIN(pos[1],y)][MAX(pos[0],x)][MAX(pos[1],y)]));
}
void step(int dir)
{
switch(dir) {
case LEFT: pos[0]--; std::cout << "L" << std::flush; direction=LEFT;
break;
case UP: pos[1]--; std::cout << "U" << std::flush; direction=UP;
break;
case RIGHT: pos[0]++; std::cout << "R" << std::flush; direction=RIGHT;
break;
case DOWN: pos[1]++; std::cout << "D" << std::flush; direction=DOWN;
break;
}
return;
}
void move(void)
{
do {
if(isconnect((direction+LEFT-1+4)%4))
step((direction+LEFT-1+4)%4);
else if(isconnect((direction+UP-1+4)%4))
step((direction+UP-1+4)%4);
else if(isconnect((direction+RIGHT-1+4)%4))
step((direction+RIGHT-1+4)%4);
else
//std::cerr << "error" << std::endl;
//std::cerr << "(x,y):" << pos[0] << "," << pos[1] << std::endl;
}while(!(pos[0]==0 && pos[1]==0));
std::cout << std::endl;
return;
}
int main(void)
{
for(int i=0; i<5; i++)
for(int j=0; j<5; j++)
for(int k=0; j<5; j++)
for(int l=0; j<5; j++)
map[i][j][k][l] = false;
read();
move();
}
|
a.cc: In function 'void read()':
a.cc:24:17: error: 'gets' was not declared in this scope; did you mean 'getw'?
24 | gets(nul);
| ^~~~
| getw
a.cc: In function 'void move()':
a.cc:82:9: error: expected primary-expression before '}' token
82 | }while(!(pos[0]==0 && pos[1]==0));
| ^
|
s464878304
|
p00038
|
Java
|
import java.util.*;
public class _0038 {
public static void main(String[] args){
Scanner stdIn = new Scanner(System.in);
while(stdIn.hasNext()){
String str = stdIn.nextLine();
int[] number = new int[5];
int[] count = new int[14];
int j = 0;
for(int i=0;i<str.length();i++){
if('0'<=str.charAt(i) && str.charAt(i)<='9'){
number[j]=number[j]*10;
number[j]+=(int)str.charAt(i)-(int)'0';
}
else{
j++;
}
}
Arrays.sort(number);
j=0;
int k=0;
int count_x =0;
while(k<number.length){
if(number[k]==j){
count[j]++;
if(0<k){
if(number[k]-number[k-1]==1){
count_x++;
}
else{
count_x=0;
}
}
k++;
}
else{
j++;
}
}
int count_3 = 0;
int count_2 = 0;
for(int i=0;i<14;i++){
if(count[i]==4){
System.out.println("four card");
break;
}
else if(count[i]==3){
count_3++;
}
else if(count[i]==2){
count_2++;
}
if(count_3==1&&count_2==1){
System.out.println("full house");
break;
}
else if(i==12){
if(count_x == 4 || (count_x == 3 && number[0]==1)){
System.out.println("straight");
break;
}
else if(count_3==1){
System.out.println("three card");
break;
}
else if(count_2==2){
System.out.println("two pair");
break;
}
else if(count_2==1){
System.out.println("one pair");
break;
}
else{
System.out.println("null");
break;
}
}
}
}
}
}
|
Main.java:4: error: class _0038 is public, should be declared in a file named _0038.java
public class _0038 {
^
1 error
|
s832162397
|
p00038
|
Java
|
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main{
Map<Integer, Integer> number_of_cards;
PokerHand(int... cards){
this.number_of_cards = new HashMap<Integer, Integer>();
for(int c = 1; c <= 13; c++) this.number_of_cards.put(c, 0);
for(int i: cards) this.number_of_cards.put(i, this.number_of_cards.get(i) + 1);
}
Poker judge() {
//onepair, twopair, threecard, fourcard, fullhouse
int num_pair = 0;
int num_three = 0;
int num_four = 0;
for(Map.Entry<Integer, Integer> e: this.number_of_cards.entrySet()) {
if(e.getValue() == 2) num_pair++;
else if(e.getValue() == 3) num_three++;
else if(e.getValue() == 4) num_four++;
}
//straight
boolean straight = false;
out: for(int c = 1; c <= 9; c++) {
for(int i = c; i < c+5; i++) {
if(this.number_of_cards.get(i) != 1) continue out;
}
straight = true;
break;
}
//straight 10 J Q K A
out: if(this.number_of_cards.get(1) == 1) {
for(int c = 10; c <= 13; c++) {
if(this.number_of_cards.get(c) != 1) break out;
}
straight = true;
}
//judge
if(num_four == 1) return Poker.FOURCARDS;
else if(num_three == 1 && num_pair == 1) return Poker.FULLHOUSE;
else if(straight) return Poker.STRAIGHT;
else if(num_three == 1) return Poker.THREECARDS;
else if(num_pair == 2) return Poker.TWOPAIR;
else if(num_pair == 1) return Poker.ONEPAIR;
else return Poker.NULL;
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNextLine()) {
String line = sc.nextLine();
Scanner scstr = new Scanner(line);
scstr.useDelimiter(",");
int[] cards = new int[5];
for(int i = 0; i < cards.length; i++) {
cards[i] = scstr.nextInt();
}
scstr.close();
System.out.println(new PokerHand(cards).judge());
scstr.close();
}
sc.close();
}
}
enum Poker{
NULL("null"), ONEPAIR("one pair"), TWOPAIR("two pair"), THREECARDS("three card"),
STRAIGHT("straight"), FULLHOUSE("full house"), FOURCARDS("four card");
String name;
public String toString() {
return this.name;
}
Poker(String str) {
this.name = str;
}
}
|
Main.java:10: error: invalid method declaration; return type required
PokerHand(int... cards){
^
1 error
|
s049573030
|
p00038
|
Java
|
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNextLine()) {
String[] cards = sc.nextLine().split(",");
// ??????????????????????????????
if (isFourCard(cards)) {
System.out.println("four card");
continue;
}
// ????????¬??????????????????
if (isStraight(cards)) {
System.out.println("straight");
continue;
}
// ???????????????
if (isFullHouse(cards)) {
System.out.println("full house");
continue;
}
// ??????????????????????????????
if (isthreeCard(cards)) {
System.out.println("three card");
continue;
}
// ???????????¢????????????
if (isTwoPare(cards)) {
System.out.println("two pair");
continue;
}
// ???????????¢????????????
if (isOnePare(cards)) {
System.out.println("one pair");
continue;
}
// ????????§?????????????????°null
System.out.println("null");
}
}
private static boolean isFourCard(String[] cards) {
return isPareCards(4, cards, false);
}
private static boolean isStraight(String[] cards) {
Arrays.sort(cards, new PokerHand().new Compare());
if (isRoyalStraight(cards)) {
return true;
}
for (int i = 1; i < cards.length; i++) {
int draw = Integer.parseInt(cards[i]) - Integer.parseInt(cards[i - 1]);
if (draw != 1) {
return false;
}
}
return true;
}
private static boolean isRoyalStraight(String[] cards) {
Arrays.sort(cards, new PokerHand().new Compare());
String[] speStraight = { "1", "10", "11", "12", "13" };
for (int i = 0; i < cards.length; i++) {
if (!speStraight[i].equals(cards[i])) {
return false;
}
}
return true;
}
private static boolean isFullHouse(String[] cards) {
return isPareCards(3, cards, false) && isPareCards(2, cards, false);
}
private static boolean isthreeCard(String[] cards) {
return isPareCards(3, cards, false);
}
private static boolean isTwoPare(String[] cards) {
return isPareCards(2, cards, true);
}
private static boolean isOnePare(String[] cards) {
return isPareCards(2, cards, false);
}
// ?????????????????°????????°??????????????°???????????¨????????????
private static boolean isPareCards(int number, String[] cards, boolean pares) {
HashMap<String, Integer> map = new HashMap<>();
for (int i = 0; i < cards.length; i++) {
int count = 0;
if (map.containsKey(cards[i])) {
count = map.get(cards[i]) + 1;
} else {
count = 1;
}
map.put(cards[i], count);
}
int pareCount = 0;
for (String key : map.keySet()) {
if (map.get(key) == number) {
pareCount++;
}
}
// ???????????¢????????????????????´?????????????????§??????
if (pares && pareCount == 2) {
return true;
}
return !pares && pareCount == 1;
}
// ??\???????????°????????????????????????????????¬?????????
public class Compare implements Comparator<String> {
@Override
public int compare(String o1, String o2) {
return Integer.parseInt(o1) - Integer.parseInt(o2);
}
}
}
|
Main.java:53: error: cannot find symbol
Arrays.sort(cards, new PokerHand().new Compare());
^
symbol: class PokerHand
location: class Main
Main.java:70: error: cannot find symbol
Arrays.sort(cards, new PokerHand().new Compare());
^
symbol: class PokerHand
location: class Main
2 errors
|
s564438566
|
p00038
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class P0038 {
/**
* 0038 Poker Hand
*/
public static void main(String[] args) throws IOException {
// Read All Hands
List<Hand> hands = readHands();
for (Hand hand : hands) {
// Judge a hand
String handName = hand.judge();
// Write a result
System.out.println(handName);
}
}
/**
* Read all input line and return the list of hand.
*
* @return List of Hand
*/
protected static List<Hand> readHands() throws IOException {
List<Hand> hands = new ArrayList<Hand>();
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
// One line to one Hand
String line = null;
while ((line = reader.readLine()) != null) {
// Convert line to int array
String[] values = line.split(",");
int[] cards = new int[values.length];
for (int i = 0; i < values.length; i++) {
cards[i] = Integer.parseInt(values[i]);
}
// Create hand and add to list
hands.add(new Hand(cards));
}
if (reader != null) {
reader.close();
}
return hands;
}
/**
* Hand class
*/
static class Hand {
/** card array */
int[] cards;
/**
* Constructor
*
* @param cards card array
*/
public Hand(final int[] cards) {
// Copy arguments to fields
this.cards = new int[5];
System.arraycopy(cards, 0, this.cards, 0, cards.length);
}
/**
* Judge this hand.
*
* @return Hand name if this hand has some role or null
*/
public String judge() {
// Count
int[] numberOfCards = new int[14]; // A to K (index 0 is not used)
for (int card : cards) {
numberOfCards[card]++;
}
// Find role elements
int pair = 0;
int threeCard = 0;
int fourCard = 0;
for (int number : numberOfCards) {
switch (number) {
case 2:
pair++;
break;
case 3:
threeCard++;
break;
case 4:
fourCard++;
break;
}
}
// Judge "Four Card"
if (fourCard > 0) {
return "four card";
}
// Judge "Full House"
if (pair > 0 && threeCard > 0) {
return "full house";
}
// Prepare to judge "Straight"
int[] straightJudge = new int[5];
System.arraycopy(cards, 0, straightJudge, 0, cards.length);
Arrays.sort(straightJudge);
// Judge "Straight" (is all card is sequantial?)
int sequenceCount = 0;
for (int i = 1; i < straightJudge.length; i++) {
if ((straightJudge[i] - straightJudge[i - 1]) == 1) {
sequenceCount++;
}
}
if (sequenceCount == 4) {
return "straight";
}
// Judge "Straight" (is special straight including A)
if (straightJudge[0] == 1 && straightJudge[1] == 10 && straightJudge[2] == 11 && straightJudge[3] == 12
&& straightJudge[4] == 13) {
return "straight";
}
// Judge "Three card"
if (threeCard > 0) {
return "three card";
}
// Judge "Two pair"
if (pair > 1) {
return "two pair";
}
// Judge "One pair"
if (pair > 0) {
return "one pair";
}
return null;
}
}
}
|
Main.java:8: error: class P0038 is public, should be declared in a file named P0038.java
public class P0038 {
^
1 error
|
s200231429
|
p00038
|
C
|
#include<stdio.h>
int main(){
int a,b,c,d,e;
int state = 0; //0:null;1:1pair,2:2pair,3:3card,4:hullhouse,5:straight,6:4card
while(scanf("%d,%d,%d,%d.%d",&a,&b,&c,&d,&e)!=EOF){
while(!((a<=b)&&(b<=c)&&(c<=d)&&(d<=e))){
int tmp;
if(a>b){a = tmp; a = b; b = tmp;}
if(b>c){b = tmp; b = c; c = tmp;}
if(c>d){c = tmp; c = d; d = tmp;}
if(d>e){d = tmp; d = e; e = tmp;}
}
int p1 = 0;
int p1_n = 0;
int p2 =0;
int p2_n = 0;
if(a==b){p1++; p1_n=a;}
if(b==c){
if(b == p1_n){
p1++;
}else if(p1_n==0){
p1++;
p1_n = b;
}else{
p2++;
p2_n = b;
}
}
if(c==d){
if(c == p1_n){
p1++;
}else if(p1_n==0){
p1++;
p1_n = c;
}else{
p2++;
p2_n = c;
}
}
if(d==e){
if(d == p1_n){
p1++;
}else if(p1_n==0){
p1++;
p1_n = d;
}else{
p2++;
p2_n = d;
}
}
state = 0;
if(p1==0&&p2==0){
if(a==1&&b ==10&&c==11&&d ==12&&e ==13){
state =5;
}else if(a+1==b&&b+1==c&&c+1 =d&&d+1 ==e){
state =5;
}
}else if((p1==1&&p2==1)){
state = 2;
}else if((p1==1&&p2==2)||(p1==2&&p2==1)){
state = 4;
}else if(p1==3||p2==3){
state = 6;
}else if(p1==2||p2==2){
state = 3;
}else if(p1==1&&p2==1){
state = 2;
}else if(p1==1||p2==1){
state =1;
}
swicth case(state){
case 0: printf("null\n"); break;
case 1: printf("one pair\n"); break;
case 2: printf("two pair\n"); break;
case 3: printf("three card\n"); break;
case 4: printf("hullhouse\n"); break;
case 5: printf("straight\n"); break;
case 6: printf("four card\n"); break;
}
return 0;
}
|
main.c: In function 'main':
main.c:62:39: error: lvalue required as left operand of assignment
62 | }else if(a+1==b&&b+1==c&&c+1 =d&&d+1 ==e){
| ^
main.c:80:7: error: 'swicth' undeclared (first use in this function)
80 | swicth case(state){
| ^~~~~~
main.c:80:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:80:13: error: expected ';' before 'case'
80 | swicth case(state){
| ^~~~~
| ;
main.c:93:1: error: expected declaration or statement at end of input
93 | }
| ^
|
s500308892
|
p00038
|
C
|
#include<stdio.h>
int main(){
int a[5],b[13];
while(scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])!=EOF){
for(int i=0;i<13;i++)b[i]=0;
for(int i=0;i<13;i++) b[a[i]-1]++;
for(int i=0;i<13;i++){
if(b[i]==4);
printf("four card\n");
goto exit;
}
for(int i=0;i<13;i++){
for(int j=0; j<13;j++){
if(b[i]==2&&b[j]==3){
printf("full house\n");
goto exit;
}else if(b[i]==2&&b[j]==2){
printf("two pair\n");
go to exit;
}
}
}
for(int i=0;i<13;i++){
if(b[i]==3){printf("three card\n");goto exit;}
else if(b[i]==2){printf("two pair\n"); goto exit;}
}
for(int i=0;i<13-4;i++){
if(b[i]==1&&b[i+1]==1&&b[i+2]==1&&b[i+3]==1&&b[i+4]==1){
printf("straight\n");
goto exit;
}
}
if(b[0]==1&&b[9]==1&&b[10]==1&&b[11]==1&b[12]==1){printf("straight\n"); goto exit;}
printf("null\n");
exit;
}
}
|
main.c: In function 'main':
main.c:22:16: error: unknown type name 'go'
22 | go to exit;
| ^~
main.c:22:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'exit'
22 | go to exit;
| ^~~~
main.c:45:6: error: 'exit' undeclared (first use in this function)
45 | exit;
| ^~~~
main.c:2:1: note: 'exit' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'
1 | #include<stdio.h>
+++ |+#include <stdlib.h>
2 |
main.c:45:6: note: each undeclared identifier is reported only once for each function it appears in
45 | exit;
| ^~~~
main.c:41:6: error: label 'exit' used but not defined
41 | if(b[0]==1&&b[9]==1&&b[10]==1&&b[11]==1&b[12]==1){printf("straight\n"); goto exit;}
| ^~
|
s311794647
|
p00038
|
C
|
#include<stdio.h>
int main(){
int a[5],b[13];
while(scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])!=EOF){
for(int i=0;i<13;i++)b[i]=0;
for(int i=0;i<13;i++) b[a[i]-1]++;
for(int i=0;i<13;i++){
if(b[i]==4){
printf("four card\n");
goto exit;
}
}
for(int i=0;i<13;i++){
for(int j=0; j<13;j++){
if(b[i]==2&&b[j]==3){
printf("full house\n");
goto exit;
}else if(b[i]==2&&b[j]==2){
printf("two pair\n");
go to exit;
}
}
}
for(int i=0;i<13;i++){
if(b[i]==3){printf("three card\n");goto exit;}
else if(b[i]==2){printf("two pair\n"); goto exit;}
}
for(int i=0;i<13-4;i++){
if(b[i]==1&&b[i+1]==1&&b[i+2]==1&&b[i+3]==1&&b[i+4]==1){
printf("straight\n");
goto exit;
}
}
if(b[0]==1&&b[9]==1&&b[10]==1&&b[11]==1&b[12]==1){printf("straight\n"); goto exit;}
printf("null\n");
exit;
}
}
|
main.c: In function 'main':
main.c:23:16: error: unknown type name 'go'
23 | go to exit;
| ^~
main.c:23:22: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'exit'
23 | go to exit;
| ^~~~
main.c:46:6: error: 'exit' undeclared (first use in this function)
46 | exit;
| ^~~~
main.c:2:1: note: 'exit' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'
1 | #include<stdio.h>
+++ |+#include <stdlib.h>
2 |
main.c:46:6: note: each undeclared identifier is reported only once for each function it appears in
46 | exit;
| ^~~~
main.c:42:6: error: label 'exit' used but not defined
42 | if(b[0]==1&&b[9]==1&&b[10]==1&&b[11]==1&b[12]==1){printf("straight\n"); goto exit;}
| ^~
|
s741457176
|
p00038
|
C
|
#include<stdio.h>
int main(){
int a[5],b[13];
while(scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])!=EOF){
for(int i=0;i<13;i++)b[i]=0;
for(int i=0;i<13;i++) b[a[i]-1]++;
for(int i=0;i<13;i++){
if(b[i]==4){
printf("four card\n");
goto exit;
}
}
for(int i=0;i<13;i++){
for(int j=0; j<13;j++){
if(b[i]==2&&b[j]==3){
printf("full house\n");
goto exit;
}else if(b[i]==2&&b[j]==2){
printf("two pair\n");
goto exit;
}
}
}
for(int i=0;i<13;i++){
if(b[i]==3){printf("three card\n");goto exit;}
else if(b[i]==2){printf("two pair\n"); goto exit;}
}
for(int i=0;i<13-4;i++){
if(b[i]==1&&b[i+1]==1&&b[i+2]==1&&b[i+3]==1&&b[i+4]==1){
printf("straight\n");
goto exit;
}
}
if(b[0]==1&&b[9]==1&&b[10]==1&&b[11]==1&b[12]==1){printf("straight\n"); goto exit;}
printf("null\n");
exit;
}
}
|
main.c: In function 'main':
main.c:46:6: error: 'exit' undeclared (first use in this function)
46 | exit;
| ^~~~
main.c:2:1: note: 'exit' is defined in header '<stdlib.h>'; this is probably fixable by adding '#include <stdlib.h>'
1 | #include<stdio.h>
+++ |+#include <stdlib.h>
2 |
main.c:46:6: note: each undeclared identifier is reported only once for each function it appears in
46 | exit;
| ^~~~
main.c:42:6: error: label 'exit' used but not defined
42 | if(b[0]==1&&b[9]==1&&b[10]==1&&b[11]==1&b[12]==1){printf("straight\n"); goto exit;}
| ^~
|
s889733425
|
p00038
|
C
|
#include<stdio.h>
using namespace std;
int main(){
int a[5],b[13];
while(scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])!=EOF){
for(int i=0;i<13;i++){b[i]=0;}
for(int i=0;i<5;i++){ b[a[i]-1]++;}
for(int i=0;i<13;i++){
if(b[i]==4){
printf("four card\n");
goto exit;
}
}
for(int i=0;i<13;i++){
for(int j=0; j<13;j++){
if(b[i]==2&&b[j]==3){
printf("full house\n");
goto exit;
}else if(b[i]==2&&b[j]==2){
printf("two pair\n");
goto exit;
}
}
}
for(int i=0;i<13;i++){
if(b[i]==3){printf("three card\n");goto exit;}
else if(b[i]==2){printf("two pair\n"); goto exit;}
}
for(int i=0;i<9;i++){
if(b[i]==1&&b[i+1]==1&&b[i+2]==1&&b[i+3]==1&&b[i+4]==1){
printf("straight\n");
goto exit;
}
}
if(b[0]==1&&b[9]==1&&b[10]==1&&b[11]==1&b[12]==1){printf("straight\n"); goto exit;}
printf("null\n");
exit:;
}
}
|
main.c:3:1: error: unknown type name 'using'
3 | using namespace std;
| ^~~~~
main.c:3:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
3 | using namespace std;
| ^~~
|
s622138424
|
p00038
|
C
|
#include<stdio.h>
#define P 5
int main(void)
{
int card[P] = {0, 0, 0, 0, 0};
int i = 0;
int j = 0;
int k = 0;
int m = 0;
int count = 0;
int t = 0;
int c[P] = {0, 0, 0, 0, 0};
while( scanf("%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4]) != EOF )
{
for(i = 0; i < P ; i++)
{
for(j = 0; j < P ; j++)
{
if(card[i] > card[j])
{
m = card[i];
card[i] = card[j];
card[j] = m;
}
}
}
for(i = 0; i < P ; i++)
{
for(j = i + 1; j < P ; j++)
{
if(card[i] == card[j])
{
count++;
}
}
}
if(count == 0)
{
for(k = 0 ;k < P; k++)
{
c[k] = card[k] + k;
}
for(i = 1 ;i < P; i++)
{
if(c[0] == c[i])
{
t++;
}
}
if((t == 4) || (card[0] == 13 && card[1] == 12 && card[2] == 11 && card[3] == 10 && card[4] == 1))
{
printf("straight\n");
}
else
{
printf("null\n");
}
}
else if(count == 1)
{
printf("one pair\n");
}
else if(count == 2)
{
printf("two pair\n");
}
else if(count == 3)
{
printf("three card\n");
}
else if(count == 4)
{
/bin/bash: indent: コマンドが見つかりません
else if(count == 6)
{
printf("four card\n");
}
t = 0;
m = 0;
count = 0;
for(i = 0; i < P; i++)
{
c[i] = 0;
card[i] = 0;
}
i = 0;
j = 0;
k = 0;
}
return 0;
}
|
main.c: In function 'main':
main.c:77:1: error: expected expression before '/' token
77 | /bin/bash: indent: コマンドが見つかりません
| ^
main.c:95:1: error: expected declaration or statement at end of input
95 | }
| ^
|
s771533501
|
p00038
|
C
|
int count = 0;
int t = 0;
int c[P] = {0, 0, 0, 0, 0};
while( scanf("%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4]) != EOF )
{
for(i = 0; i < P ; i++)
{
for(j = 0; j < P ; j++)
{
if(card[i] > card[j])
{
m = card[i];
card[i] = card[j];
card[j] = m;
}
}
}
for(i = 0; i < P ; i++)
{
for(j = i + 1; j < P ; j++)
{
if(card[i] == card[j])
{
count++;
}
}
}
if(count == 0)
{
for(k = 0 ;k < P; k++)
{
c[k] = card[k] + k;
}
for(i = 1 ;i < P; i++)
{
if(c[0] == c[i])
{
t++;
}
}
if((t == 4) || (card[0] == 13 && card[1] == 12 && card[2] == 11 && card[3] == 10 && card[4] == 1))
{
printf("straight\n");
}
else
{
printf("null\n");
}
}
else if(count == 1)
{
printf("one pair\n");
}
else if(count == 2)
{
printf("two pair\n");
}
else if(count == 3)
{
printf("three card\n");
}
else if(count == 4)
{
printf("full house\n");
}
else if(count == 6)
{
printf("four card\n");
}
t = 0;
m = 0;
count = 0;
for(i = 0; i < P; i++)
{
c[i] = 0;
card[i] = 0;
}
i = 0;
j = 0;
k = 0;
}
return 0;
}
|
main.c:3:15: error: 'P' undeclared here (not in a function)
3 | int c[P] = {0, 0, 0, 0, 0};
| ^
main.c:5:9: error: expected identifier or '(' before 'while'
5 | while( scanf("%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4]) != EOF )
| ^~~~~
main.c:84:9: error: expected identifier or '(' before 'return'
84 | return 0;
| ^~~~~~
main.c:85:1: error: expected identifier or '(' before '}' token
85 | }
| ^
|
s247031443
|
p00038
|
C
|
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b){
return *(int*)a - *(int*)b;
}
int main(int argc,char* argv[]){
int first_card,is_st;
int i;
int max,max2,max3,max4;
int cards[5];
int hands[13];
while(scanf("%d,%d,%d,%d,%d",&cards[0],&cards[1],&cards[2],&cards[3],&cards[4]) != EOF){
max = max2 = 0;is_st = 1;
qsort(cards, 5, sizeof(int), compare_int);
for(i = 0;i < 13;i++){
hands[i] = 0;
}
for(i = 0;i < 5;i++){
hands[cards[i] - 1]++;
}
for(i = 0;i < 13;i++){
if(max <= hands[i]){
max2 = ma;
max = hands[i];
}else if(max2 <= hands[i]){
max2 = hands[i];
}
}
if(max == 4){
printf("four card\n");
continue;
}
if(max == 3 && max2 == 2){
printf("full house\n");
continue;
}
first_card = cards[0];
for(i = 1;i < 5;i++){
if(first_card + 1 != cards[i]){is_st = 0;break;}else{
first_card++;
}
}
if(is_st || (cards[0] == 1 && cards[1] == 10 && cards[2] == 11 && cards[3] == 12 && cards[4] == 13)){
printf("straight\n");
continue;
}
if(max == 3){
printf("three card\n");
continue;
}
if(max == 2 && max2 == 2){
printf("two pair\n");
continue;
}
if(max == 2){
printf("one pair\n");
continue;
}
printf("null\n");
}
return 0;
}
|
main.c: In function 'main':
main.c:30:16: error: 'ma' undeclared (first use in this function); did you mean 'max'?
30 | max2 = ma;
| ^~
| max
main.c:30:16: note: each undeclared identifier is reported only once for each function it appears in
|
s365669698
|
p00038
|
C
|
#include <cstdio>
#include <functional>
#include <algorithm>
using namespace std;
/** Application main entry point. */
int main (
int argc,
char * argv[ ]
)
{
int d[ 5 ];
int i;
while ( scanf ( " %d,%d,%d,%d,%d"
, d, d + 1, d + 2, d + 3, d + 4 ) == 5 )
{
int c[ 13 ] = { 0 };
sort ( d, d + 5 );
for ( i = 0; i < 5; ++i )
{
++c[ d[ i ] - 1 ];
}
sort ( c, c + 13, greater< int > ( ) );
if ( c[ 0 ] == 4 )
{
puts ( "four card" );
}
else if ( c[ 0 ] == 3 && c[ 1 ] == 2 )
{
puts ( "full house" );
}
else if ( ( d[ 0 ] == d[ 1 ] - 1
&& d[ 0 ] == d[ 2 ] - 2
&& d[ 0 ] == d[ 3 ] - 3
&& d[ 0 ] == d[ 4 ] - 4 )
|| ( d[ 0 ] == 1
&& d[ 1 ] == 10
&& d[ 2 ] == 11
&& d[ 3 ] == 12
&& d[ 4 ] == 13 ) )
{
puts ( "straight" );
}
else if ( c[ 0 ] == 3 )
{
puts ( "three card" );
}
else if ( c[ 0 ] == 2 && c[ 1 ] == 2 )
{
puts ( "two pair" );
}
else if ( c[ 0 ] == 2 )
{
puts ( "one pair" );
}
else
{
puts ( "null" );
}
}
return ( 0 );
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s042539675
|
p00038
|
C
|
int main(void){ int card[5],ans,n,i,l,t,f; while(scanf(" %d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4])!=EOF){ //昇順にソート for(i=0;i<4;i++){ for(l=4;l>i;l--){ if(card[l-1]>card[l]){ t=card[l-1]; card[l-1]=card[l]; card[l]=t; } } } //ストレート判定 for(f=0,i=4;i>0;i--){ if(i==1 && card[1]==10 && card[0]==1)f=1; if(card[i]!=card[i-1]+1)break; if(i==1)f=1; } //スリーペア if(f==0){ for(i=0;i<3;i++){ if(card[i]==card[i+2])f=3; } } //ワンペア判定 if(f==0){ for(i=0;i<4;i++){ if(card[i]==card[i+1])f=2; } } if(card[0]==card[3] || card[1]==card[4]){ printf("four card\n"); } else if((card[0]==card[1] && card[2]==card[4]) || card[0]==card[2] && card[3]==card[4]){ printf("full house\n"); } else if(f==1){ printf("straight\n"); } else if(f==3){ printf("three card\n"); } else if((card[0]==card[1] && (card[2]==card[3] || card[3]==card[4])) || (card[1]==card[2] && card[3]==card[4])){ printf("two pair\n"); } else if(f==2){ printf("one pair\n"); } else{ printf("null\n"); } } return 0; }
|
main.c: In function 'main':
main.c:1:64: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | int main(void){ int card[5],ans,n,i,l,t,f; while(scanf(" %d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4])!=EOF){ //昇順にソート for(i=0;i<4;i++){ for(l=4;l>i;l--){ if(card[l-1]>card[l]){ t=card[l-1]; card[l-1]=card[l]; card[l]=t; } } } //ストレート判定 for(f=0,i=4;i>0;i--){ if(i==1 && card[1]==10 && card[0]==1)f=1; if(card[i]!=card[i-1]+1)break; if(i==1)f=1; } //スリーペア if(f==0){ for(i=0;i<3;i++){ if(card[i]==card[i+2])f=3; } } //ワンペア判定 if(f==0){ for(i=0;i<4;i++){ if(card[i]==card[i+1])f=2; } } if(card[0]==card[3] || card[1]==card[4]){ printf("four card\n"); } else if((card[0]==card[1] && card[2]==card[4]) || card[0]==card[2] && card[3]==card[4]){ printf("full house\n"); } else if(f==1){ printf("straight\n"); } else if(f==3){ printf("three card\n"); } else if((card[0]==card[1] && (card[2]==card[3] || card[3]==card[4])) || (card[1]==card[2] && card[3]==card[4])){ printf("two pair\n"); } else if(f==2){ printf("one pair\n"); } else{ printf("null\n"); } } return 0; }
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main(void){ int card[5],ans,n,i,l,t,f; while(scanf(" %d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4])!=EOF){ //昇順にソート for(i=0;i<4;i++){ for(l=4;l>i;l--){ if(card[l-1]>card[l]){ t=card[l-1]; card[l-1]=card[l]; card[l]=t; } } } //ストレート判定 for(f=0,i=4;i>0;i--){ if(i==1 && card[1]==10 && card[0]==1)f=1; if(card[i]!=card[i-1]+1)break; if(i==1)f=1; } //スリーペア if(f==0){ for(i=0;i<3;i++){ if(card[i]==card[i+2])f=3; } } //ワンペア判定 if(f==0){ for(i=0;i<4;i++){ if(card[i]==card[i+1])f=2; } } if(card[0]==card[3] || card[1]==card[4]){ printf("four card\n"); } else if((card[0]==card[1] && card[2]==card[4]) || card[0]==card[2] && card[3]==card[4]){ printf("full house\n"); } else if(f==1){ printf("straight\n"); } else if(f==3){ printf("three card\n"); } else if((card[0]==card[1] && (card[2]==card[3] || card[3]==card[4])) || (card[1]==card[2] && card[3]==card[4])){ printf("two pair\n"); } else if(f==2){ printf("one pair\n"); } else{ printf("null\n"); } } return 0; }
main.c:1:64: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | int main(void){ int card[5],ans,n,i,l,t,f; while(scanf(" %d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4])!=EOF){ //昇順にソート for(i=0;i<4;i++){ for(l=4;l>i;l--){ if(card[l-1]>card[l]){ t=card[l-1]; card[l-1]=card[l]; card[l]=t; } } } //ストレート判定 for(f=0,i=4;i>0;i--){ if(i==1 && card[1]==10 && card[0]==1)f=1; if(card[i]!=card[i-1]+1)break; if(i==1)f=1; } //スリーペア if(f==0){ for(i=0;i<3;i++){ if(card[i]==card[i+2])f=3; } } //ワンペア判定 if(f==0){ for(i=0;i<4;i++){ if(card[i]==card[i+1])f=2; } } if(card[0]==card[3] || card[1]==card[4]){ printf("four card\n"); } else if((card[0]==card[1] && card[2]==card[4]) || card[0]==card[2] && card[3]==card[4]){ printf("full house\n"); } else if(f==1){ printf("straight\n"); } else if(f==3){ printf("three card\n"); } else if((card[0]==card[1] && (card[2]==card[3] || card[3]==card[4])) || (card[1]==card[2] && card[3]==card[4])){ printf("two pair\n"); } else if(f==2){ printf("one pair\n"); } else{ printf("null\n"); } } return 0; }
| ^~~~~
main.c:1:64: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:135: error: 'EOF' undeclared (first use in this function)
1 | int main(void){ int card[5],ans,n,i,l,t,f; while(scanf(" %d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4])!=EOF){ //昇順にソート for(i=0;i<4;i++){ for(l=4;l>i;l--){ if(card[l-1]>card[l]){ t=card[l-1]; card[l-1]=card[l]; card[l]=t; } } } //ストレート判定 for(f=0,i=4;i>0;i--){ if(i==1 && card[1]==10 && card[0]==1)f=1; if(card[i]!=card[i-1]+1)break; if(i==1)f=1; } //スリーペア if(f==0){ for(i=0;i<3;i++){ if(card[i]==card[i+2])f=3; } } //ワンペア判定 if(f==0){ for(i=0;i<4;i++){ if(card[i]==card[i+1])f=2; } } if(card[0]==card[3] || card[1]==card[4]){ printf("four card\n"); } else if((card[0]==card[1] && card[2]==card[4]) || card[0]==card[2] && card[3]==card[4]){ printf("full house\n"); } else if(f==1){ printf("straight\n"); } else if(f==3){ printf("three card\n"); } else if((card[0]==card[1] && (card[2]==card[3] || card[3]==card[4])) || (card[1]==card[2] && card[3]==card[4])){ printf("two pair\n"); } else if(f==2){ printf("one pair\n"); } else{ printf("null\n"); } } return 0; }
| ^~~
main.c:1:135: note: 'EOF' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
main.c:1:135: note: each undeclared identifier is reported only once for each function it appears in
main.c:1:1: error: expected declaration or statement at end of input
1 | int main(void){ int card[5],ans,n,i,l,t,f; while(scanf(" %d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4])!=EOF){ //昇順にソート for(i=0;i<4;i++){ for(l=4;l>i;l--){ if(card[l-1]>card[l]){ t=card[l-1]; card[l-1]=card[l]; card[l]=t; } } } //ストレート判定 for(f=0,i=4;i>0;i--){ if(i==1 && card[1]==10 && card[0]==1)f=1; if(card[i]!=card[i-1]+1)break; if(i==1)f=1; } //スリーペア if(f==0){ for(i=0;i<3;i++){ if(card[i]==card[i+2])f=3; } } //ワンペア判定 if(f==0){ for(i=0;i<4;i++){ if(card[i]==card[i+1])f=2; } } if(card[0]==card[3] || card[1]==card[4]){ printf("four card\n"); } else if((card[0]==card[1] && card[2]==card[4]) || card[0]==card[2] && card[3]==card[4]){ printf("full house\n"); } else if(f==1){ printf("straight\n"); } else if(f==3){ printf("three card\n"); } else if((card[0]==card[1] && (card[2]==card[3] || card[3]==card[4])) || (card[1]==card[2] && card[3]==card[4])){ printf("two pair\n"); } else if(f==2){ printf("one pair\n"); } else{ printf("null\n"); } } return 0; }
| ^~~
main.c:1:1: error: expected declaration or statement at end of input
|
s080488998
|
p00038
|
C
|
#include<stdio.h>
int main(void){
int c[5];
while(scanf("%d",&c[0])!=EOF){
int i,j,work,count,flag;
//↓昇順に並べ替える↓
for(i=1;i<5;i++)scanf(",%d",&c[i]);
for(i=0;i<4;i++){
for(j=i+1;j<5;j++){
if(c[i]>c[j]){
work=c[i];
c[i]=c[j];
c[j]=work;
}
}
}
//↓4カードの判定↓
(c[0]==c[1])?i=0:i=1;
count=0;
for(j=1;j<4;j++){
if(c[i]==c[i+j])count++;
}
if(count==3){
puts("four card");
continue;
}
//↓フルハウスの判定↓
count=0;
if(c[0]==c[1])count++;
if(c[0]==c[2])count++;
for(i=count+1;i<4;i++){
if(c[i]==c[i+1])count++;
}
if(count==3){
puts("full house");
continue;
}
//↓ストレートの判定↓
count=flag=0;
if(c[0]==1 &&c[1]==10){
flag=1;
c[0]=9;
}
for(i=0;i<4;i++){
if(c[i]==c[i+1]-1)count++;
}
if(count==4){
puts("straight");
continue;
}
if(flag==1)c[0]=1;
//↓3カードの判定↓
count=flag=0;
for(i=0;i<4;i++){
if(c[i]==c[i+1])count++;
else count=0;
if(count==2){
puts("three card");
flag=1;
}
}
if(flag==1)continue;
//↓2ペア or 1ペア or 豚の判定↓
count=0;
for(i=0;i<4;i++){
if(c[i]==c[i+1])count++;
}
switch(count){
case 2:puts("two pair");
break;
case 1:puts("one pair");
break;
default:puts("null");
}
}
return 0;
}
|
main.c: In function 'main':
main.c:18:27: error: lvalue required as left operand of assignment
18 | (c[0]==c[1])?i=0:i=1;
| ^
|
s325193413
|
p00038
|
C
|
#include<stdio.h>
int main(void){
int c[5];
while(scanf("%d",&c[0])!=EOF){
int i,j,work,count,flag;
for(i=1;i<5;i++)scanf(",%d",&c[i]);
for(i=0;i<4;i++){
for(j=i+1;j<5;j++){
if(c[i]>c[j]){
work=c[i];
c[i]=c[j];
c[j]=work;
}
}
}
(c[0]==c[1])?i=0:i=1;
count=0;
for(j=1;j<4;j++){
if(c[i]==c[i+j])count++;
}
if(count==3){
puts("four card");
continue;
}
count=0;
if(c[0]==c[1])count++;
if(c[0]==c[2])count++;
for(i=count+1;i<4;i++){
if(c[i]==c[i+1])count++;
}
if(count==3){
puts("full house");
continue;
}
count=flag=0;
if(c[0]==1 &&c[1]==10){
flag=1;
c[0]=9;
}
for(i=0;i<4;i++){
if(c[i]==c[i+1]-1)count++;
}
if(count==4){
puts("straight");
continue;
}
if(flag==1)c[0]=1;
count=flag=0;
for(i=0;i<4;i++){
if(c[i]==c[i+1])count++;
else count=0;
if(count==2){
puts("three card");
flag=1;
}
}
if(flag==1)continue;
count=0;
for(i=0;i<4;i++){
if(c[i]==c[i+1])count++;
}
switch(count){
case 2:
puts("two pair");
break;
case 1:
puts("one pair");
break;
default:
puts("null");
break;
}
}
return 0;
}
|
main.c: In function 'main':
main.c:18:27: error: lvalue required as left operand of assignment
18 | (c[0]==c[1])?i=0:i=1;
| ^
|
s377109648
|
p00038
|
C
|
#include<stdio.h>
int main(void){
int c[5];
while(scanf("%d",&c[0])!=EOF){
int i,j,work,count,flag;
for(i=1;i<5;i++)scanf(",%d",&c[i]);
for(i=0;i<4;i++){
for(j=i+1;j<5;j++){
if(c[i]>c[j]){
work=c[i];
c[i]=c[j];
c[j]=work;
}
}
}
(c[0]==c[1])?i=0:i=1;
count=0;
for(j=1;j<4;j++){
if(c[i]==c[i+j])count++;
}
if(count==3){
puts("four card");
continue;
}
count=0;
if(c[0]==c[1])count++;
if(c[0]==c[2])count++;
for(i=count+1;i<4;i++){
if(c[i]==c[i+1])count++;
}
if(count==3){
puts("full house");
continue;
}
count=0;
flag=0;
if(c[0]==1 &&c[1]==10){
flag=1;
c[0]=9;
}
for(i=0;i<4;i++){
if(c[i]==c[i+1]-1)count++;
}
if(count==4){
puts("straight");
continue;
}
if(flag==1)c[0]=1;
count=0;
flag=0;
for(i=0;i<4;i++){
if(c[i]==c[i+1])count++;
else count=0;
if(count==2){
puts("three card");
flag=1;
}
}
if(flag==1)continue;
count=0;
for(i=0;i<4;i++){
if(c[i]==c[i+1])count++;
}
switch(count){
case 2:
puts("two pair");
break;
case 1:
puts("one pair");
break;
default:
puts("null");
break;
}
}
return 0;
}
|
main.c: In function 'main':
main.c:18:27: error: lvalue required as left operand of assignment
18 | (c[0]==c[1])?i=0:i=1;
| ^
|
s797435411
|
p00038
|
C
|
#include <cstdio>
#include <algorithm>
using namespace std;
int main(void)
{
int hand[5];
int i, j;
while (scanf("%d", hand) != EOF){
int straight = 1;
int pair = 0;
int three = 0;
int four = 0;
for (i = 1; i < 5; i++){
scanf("%*c%d", hand + i);
}
sort(hand, hand + 5);
for (i = 0; i < 5 || !puts(""); i++){
printf("%d ", hand[i]);
}
for (i = 0; i < 4; i++){
if (hand[i] == hand[i + 1]){
pair++;
i++;
}
}
for (i = 0; i < 3; i++){
if (hand[i] == hand[i + 1] && hand[i] == hand[i + 2]){
three = 1;
pair -= 2;
}
}
for (i = 0; i < 2; i++){
if (hand[i] == hand[i + 1] && hand[i] == hand[i + 2] && hand[i] == hand[i + 3]){
four = 1;
}
}
for (i = 0; i < 4; i++){
if (hand[i] != hand[i + 1] - 1){
straight = 0;
break;
}
}
if (hand[1] == 10 && hand[2] == 11 && hand[3] == 12 && hand[4] == 13 && hand[0] == 1){
straight = 1;
}
if (straight == 1){
puts("straight");
}
else if (four == 1){
puts("four card");
}
else if (pair == 1 && three == 1){
puts("full house");
}
else if (three == 1){
puts("three card");
}
else if (pair == 2){
puts("two pair");
}
else if (pair == 1){
puts("one pair");
}
else {
puts("null");
}
puts("");
}
return 0;
}
|
main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s544033484
|
p00038
|
C++
|
int main(){
int tmp[5];
char com;
while(cin >>tmp[0]>>com>>tmp[1]>>com>>tmp[2]>>com>>tmp[3]>>com>>tmp[4]){
int hand[15]={};
for(int i=0; i<5; ++i){
if(tmp[i]==1)++hand[13];
++hand[tmp[i]-1];
}
int pair=0,three=0,str=0,four=0;
for(int i=1; i<15; ++i){
if(hand[i]==4){++four;}
if(hand[i]==1)++str;
if(hand[i]==2)++pair;
if(hand[i]==3)++three;
if(str!=5 && hand[i]==0)str=0;
}
if(four)cout << "four card" << endl;
else if(three && pair)cout << "full house" << endl;
else if(str == 5)cout << "straight" << endl;
else if(three)cout << "three card" << endl;
else if(pair == 2)cout << "two pair" << endl;
else if(pair == 1)cout << "one pair" << endl;
else cout << "null" << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:4:11: error: 'cin' was not declared in this scope
4 | while(cin >>tmp[0]>>com>>tmp[1]>>com>>tmp[2]>>com>>tmp[3]>>com>>tmp[4]){
| ^~~
a.cc:21:13: error: 'cout' was not declared in this scope
21 | if(four)cout << "four card" << endl;
| ^~~~
a.cc:21:36: error: 'endl' was not declared in this scope
21 | if(four)cout << "four card" << endl;
| ^~~~
a.cc:22:27: error: 'cout' was not declared in this scope
22 | else if(three && pair)cout << "full house" << endl;
| ^~~~
a.cc:22:51: error: 'endl' was not declared in this scope
22 | else if(three && pair)cout << "full house" << endl;
| ^~~~
a.cc:23:22: error: 'cout' was not declared in this scope
23 | else if(str == 5)cout << "straight" << endl;
| ^~~~
a.cc:23:44: error: 'endl' was not declared in this scope
23 | else if(str == 5)cout << "straight" << endl;
| ^~~~
a.cc:24:19: error: 'cout' was not declared in this scope
24 | else if(three)cout << "three card" << endl;
| ^~~~
a.cc:24:43: error: 'endl' was not declared in this scope
24 | else if(three)cout << "three card" << endl;
| ^~~~
a.cc:25:23: error: 'cout' was not declared in this scope
25 | else if(pair == 2)cout << "two pair" << endl;
| ^~~~
a.cc:25:45: error: 'endl' was not declared in this scope
25 | else if(pair == 2)cout << "two pair" << endl;
| ^~~~
a.cc:26:23: error: 'cout' was not declared in this scope
26 | else if(pair == 1)cout << "one pair" << endl;
| ^~~~
a.cc:26:45: error: 'endl' was not declared in this scope
26 | else if(pair == 1)cout << "one pair" << endl;
| ^~~~
a.cc:27:10: error: 'cout' was not declared in this scope
27 | else cout << "null" << endl;
| ^~~~
a.cc:27:28: error: 'endl' was not declared in this scope
27 | else cout << "null" << endl;
| ^~~~
|
s003590689
|
p00038
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> poker;
int check[15] = {0};
int two = 0; int three = 0; int four = 0;
int ans = 0;
string trump;
getline(cin,trump));
int a = 0;
int b = 0;
for(char e : trump){
if(e == 49){
if(b == 0){
b = 1;
}
else{
a = (e - 48) + 10;
poker.push_back(a);
b = 0;
}
}
else if(48 <= e && 57 >= e && e != 49){
if(b == 1){
a = (e - 48) + 10;
b = 0;
}
else{
a = e - 48;
}
poker.push_back(a);
}
else{
if(b == 1){
poker.push_back(b);
b = 0;
}
}
}
if(b == 1){
poker.push_back(b);
}
for(int e : poker){
++check[e];
}
check[14] = check[1];
for(int i = 1;i < 14;++i){
if(check[i] == 4){
++four;
}
else if(check[i] == 3){
++three;
}
else if(check[i] == 2){
++two;
}
}
if(four == 1){
cout<<"four card"<<endl;
ans = 1;
}
else if(three == 1){
ans = 1;
if(two == 1){
cout<<"full house"<<endl;
}
else{
cout<<"three card"<<endl;
}
}
else if(two == 2){
ans = 1;
cout<<"two pair"<<endl;
}
else if(two == 1){
ans = 1;
cout<<"one pair"<<endl;
}
else{
for(int i = 1;i < 11;++i){
if(check[i] == check[i+1] && check[i] == check[i+2] && check[i] == check[i+3] && check[i] == check[i+4] && check[i] != 0){
cout<<"straight"<<endl;
ans = 1;
break;
}
}
}
if(ans == 0){
cout<<"null"<<endl;
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:13:21: error: expected ';' before ')' token
13 | getline(cin,trump));
| ^
| ;
a.cc: At global scope:
a.cc:105:3: error: expected unqualified-id before 'return'
105 | return 0;
| ^~~~~~
a.cc:106:1: error: expected declaration before '}' token
106 | }
| ^
|
s250829234
|
p00038
|
C++
|
#include <stdio.h>
#include <algorithm.h>
using namespace std;
int main(void)
{
int card[5];
int count1;
int count2;
int straight;
int i;
int j;
char conma;
while (scanf("%d", &card[0]) != EOF){
for (i = 1; i < 5; i++){
scanf("%c %d", &conma, &card[i]);
}
sort(card, card + 5);
count1 = 0;
count2 = 0;
straight = 0;
for (i = 0; i < 4; i++){
if (card[i] + 1 == card[i + 1]){
straight++;
}
if (card[i] == card[i + 1] && card[i] == card[0]){
count1++;
}
else if (card[i] == card[i + 1] && card[i] != card[0]){
count2++;
}
}
if ((count1 == 1 && count2 == 0) || (count1 == 0 && count2 == 1)){
printf("one pair\n");
}
else if (count1 == 1 && count1 == count2){
printf("two pair\n");
}
else if (count1 + count2 == 3 && count1 != 0 && count2 != 0){
printf("full house\n");
}
else if (count1 == 2 || count2 == 2){
printf("three card\n");
}
else if (straight == 4){
printf("straight\n");
}
else if (card[0] == 1 && card[1] == 10 && card[2] == 11 && card[3] == 12 && card[4] == 13){
printf("straight\n");
}
else if (count1 == 3 || count2 == 3){
printf("four card\n");
}
else {
printf("null\n");
}
}
return 0;
}
|
a.cc:2:10: fatal error: algorithm.h: No such file or directory
2 | #include <algorithm.h>
| ^~~~~~~~~~~~~
compilation terminated.
|
s302481953
|
p00038
|
C++
|
#include <stdio.h>
#include <algorithm.h>
using namespace std;
int main(void)
{
int card[5];
int count1;
int count2;
int straight;
int i;
int j;
char conma;
while (scanf("%d", &card[0]) != EOF){
for (i = 1; i < 5; i++){
scanf("%c %d", &conma, &card[i]);
}
sort(card, card + 5);
count1 = 0;
count2 = 0;
straight = 0;
for (i = 0; i < 4; i++){
if (card[i] + 1 == card[i + 1]){
straight++;
}
if (card[i] == card[i + 1] && card[i] == card[0]){
count1++;
}
else if (card[i] == card[i + 1] && card[i] != card[0]){
count2++;
}
}
if ((count1 == 1 && count2 == 0) || (count1 == 0 && count2 == 1)){
printf("one pair\n");
}
else if (count1 == 1 && count1 == count2){
printf("two pair\n");
}
else if (count1 + count2 == 3 && count1 != 0 && count2 != 0){
printf("full house\n");
}
else if (count1 == 2 || count2 == 2){
printf("three card\n");
}
else if (straight == 4){
printf("straight\n");
}
else if (card[0] == 1 && card[1] == 10 && card[2] == 11 && card[3] == 12 && card[4] == 13){
printf("straight\n");
}
else if (count1 == 3 || count2 == 3){
printf("four card\n");
}
else {
printf("null\n");
}
}
return 0;
}
|
a.cc:2:10: fatal error: algorithm.h: No such file or directory
2 | #include <algorithm.h>
| ^~~~~~~~~~~~~
compilation terminated.
|
s302329208
|
p00038
|
C++
|
#include <stdio.h>
#include <algorithm.h>
using namespace std;
int main(void)
{
int card[5];
int c1;
int c2;
int straight;
int i;
int j;
char conma;
while (scanf("%d", &card[0]) != EOF){
for (i = 1; i < 5; i++){
scanf("%c %d", &conma, &card[i]);
}
sort(card, card + 5);
c1 = 0;
c2 = 0;
straight = 0;
for (i = 0; i < 4; i++){
if (card[i] + 1 == card[i + 1]){
straight++;
}
if (card[i] == card[i + 1] && card[i] == card[0]){
c1++;
}
else if (card[i] == card[i + 1] && card[i] != card[0]){
c2++;
}
}
if ((c1 == 1 && c2 == 0) || (c1 == 0 && c2 == 1)){
printf("one pair\n");
}
else if (c1 == 1 && c1 == c2){
printf("two pair\n");
}
else if (c1 + c2 == 3 && c1 != 0 && c2 != 0){
printf("full house\n");
}
else if (c1 == 2 || c2 == 2){
printf("three card\n");
}
else if (straight == 4){
printf("straight\n");
}
else if (card[0] == 1 && card[1] == 10 && card[2] == 11 && card[3] == 12 && card[4] == 13){
printf("straight\n");
}
else if (c1 == 3 || c2 == 3){
printf("four card\n");
}
else {
printf("null\n");
}
}
return 0;
}
|
a.cc:2:10: fatal error: algorithm.h: No such file or directory
2 | #include <algorithm.h>
| ^~~~~~~~~~~~~
compilation terminated.
|
s179415429
|
p00038
|
C++
|
#include <stdio.h>
#include <stdcomp.h>
#include <algorithm.h>
using namespace std;
int main(void)
{
int card[5];
int count1;
int count2;
int straight;
int i;
int j;
char conma;
while (scanf("%d", &card[0]) != EOF){
for (i = 1; i < 5; i++){
scanf("%c %d", &conma, &card[i]);
}
sort(card, card + 5);
count1 = 0;
count2 = 0;
straight = 0
for (i = 0; i < 4; i++){
if (card[i] + 1 == card[i + 1]){
straight++;
}
if (card[i] == card[i + 1] && card[i] == card[0]){
count1++;
}
else if (card[i] == card[i + 1] && card[i] != card[0]){
count2++;
}
}
if ((count1 == 1 && count2 == 0) || (count1 == 0 && count2 == 1)){
printf("one pair\n");
}
else if (count1 == 1 && count1 == count2){
printf("two pair\n");
}
else if (count1 == 2 || count2 == 2){
printf("three card\n");
}
else if (straight == 4){
printf("straight\n");
}
else if (count1 == 3 || count2 == 3){
printf("four card\n");
}
else {
printf("null\n");
}
}
return 0;
}
|
a.cc:2:10: fatal error: stdcomp.h: No such file or directory
2 | #include <stdcomp.h>
| ^~~~~~~~~~~
compilation terminated.
|
s714619220
|
p00038
|
C++
|
#include <stdio.h>
#include <algorithm.h>
using namespace std;
int main(void)
{
int card[5];
int c1;
int c2;
int straight;
int i;
int j;
char conma;
while (scanf("%d", &card[0]) != EOF){
for (i = 1; i < 5; i++){
scanf("%c %d", &conma, &card[i]);
}
sort(card, card + 5);
c1 = 0;
c2 = 0;
straight = 0;
for (i = 0; i < 4; i++){
if (card[i] + 1 == card[i + 1]){
straight++;
}
if (card[i] == card[i + 1] && card[i] == card[0]){
c1++;
}
else if (card[i] == card[i + 1] && card[i] != card[0]){
c2++;
}
}
if ((c1 == 1 && c2 == 0) || (c1 == 0 && c2 == 1)){
printf("one pair\n");
}
else if (c1 == 1 && c1 == c2){
printf("two pair\n");
}
else if (c1 + c2 == 3 && c1 != 0 && c2 != 0){
printf("full house\n");
}
else if (c1 == 2 || c2 == 2){
printf("three card\n");
}
else if (straight == 4){
printf("straight\n");
}
else if (card[0] == 1 && card[1] == 10 && card[2] == 11 && card[3] == 12 && card[4] == 13){
printf("straight\n");
}
else if (c1 == 3 || c2 == 3){
printf("four card\n");
}
else {
printf("null\n");
}
}
return 0;
}
|
a.cc:2:10: fatal error: algorithm.h: No such file or directory
2 | #include <algorithm.h>
| ^~~~~~~~~~~~~
compilation terminated.
|
s690356872
|
p00038
|
C++
|
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int n[6];
int c=0,cc=0;
bool f=true;
while(scanf("%d,%d,%d,%d,%d",&n[0],&n[1],&n[2],&n[3],&n[4])!=EOF){
for(int i=0;i<5;i++)
for(int j=4;j>i;j--)
if(n[j-1]>n[j]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
for(int i=0;i<4;i++){
if(n[i]==n[i+1])c++;
else if(c>=1){cc=c;c=0;}
else {c=0;cc=0;}
}
for(int i=0;i<3;i++){
if(n[i+1]!=(n[i]+1)f=false;
}
if(n[0]==1&&n[1]==10&&n[2]==11&&n[3]==12&&n[4]==13)f=true;
if(c==3)printf("four card\n");
else if(c==2&&cc=1)printf("full house\n");
else if(f==true)printf("straight\n");
else if(c==2)printf("three card\n");
else if(n[0]==n[1]&&n[2]==n[3])printf("two pair\n");
else if(n[0]==n[1]&&n[3]==n[4])printf("two pair\n");
else if(n[1]==n[2]&&n[3]==n[4])printf("two pair\n");
else if(n[0]==n[1]||n[2]==n[3]||n[1]==n[2]||n[3]==n[4])printf("one pair\n");
c=0,cc=0;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:21:20: error: expected ';' before 'f'
21 | if(n[i+1]!=(n[i]+1)f=false;
| ^
| ;
a.cc:22:1: error: expected primary-expression before '}' token
22 | }
| ^
a.cc:21:28: error: expected ')' before '}' token
21 | if(n[i+1]!=(n[i]+1)f=false;
| ~ ^
| )
22 | }
| ~
a.cc:22:1: error: expected primary-expression before '}' token
22 | }
| ^
a.cc:30:13: error: lvalue required as left operand of assignment
30 | else if(c==2&&cc=1)printf("full house\n");
| ~~~~^~~~
|
s803566177
|
p00038
|
C++
|
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
int a[5];
char c;
while(cin>>a[0]>>c>>a[1]>>c>>a[2]>>c>>a[3]>>c>>a[4]){
sort(a,a+5);
int c[5],j=0;
memset(c,0,sizeof(c));
for(int i=0;i<4;i++){
if(a[i+1]!=a[i])
j++;
if(a[i+1]==a[i]){
c[j]++;
}
}
int p=0,t=0,f=0;
for(int i=0;i<5;i++){
if(c[i]==1)p++;
if(c[i]==2)t++;
if(c[i]==3)f++;
}
if(p==2){
cout<<"two pair"<<endl;
}
else if(p==1&&t==1)
cout<<"full house"<<endl;
else if(t==1)
cout<<"three card"<<endl;
else if(f==1)
cout<<"four card"<<endl;
else if(p==1){
cout<<"one pair"<<endl;
}
else if((a[3]==a[4]-1)&&(a[1]==a[2]-1)&&(a[2]==a[3]-1)&&((a[0]==a[1]-1)||(a[4]==13&&a[0]==1)))
cout<<"straight"<<endl;
else cout<<"null"<<endl;
}
}
|
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
10 | sort(a,a+5);
| ^~~~
| short
a.cc:12:9: error: 'memset' was not declared in this scope
12 | memset(c,0,sizeof(c));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<vector>
+++ |+#include <cstring>
4 | using namespace std;
|
s091812897
|
p00038
|
C++
|
#include<iostream>
#include<string>
#include<vector>
#include<string.h>
using namespace std;
int main(){
int a[5];
char c;
while(cin>>a[0]>>c>>a[1]>>c>>a[2]>>c>>a[3]>>c>>a[4]){
sort(a,a+5);
int c[5],j=0;
memset(c,0,sizeof(c));
for(int i=0;i<4;i++){
if(a[i+1]!=a[i])
j++;
if(a[i+1]==a[i]){
c[j]++;
}
}
int p=0,t=0,f=0;
for(int i=0;i<5;i++){
if(c[i]==1)p++;
if(c[i]==2)t++;
if(c[i]==3)f++;
}
if(p==2){
cout<<"two pair"<<endl;
}
else if(p==1&&t==1)
cout<<"full house"<<endl;
else if(t==1)
cout<<"three card"<<endl;
else if(f==1)
cout<<"four card"<<endl;
else if(p==1){
cout<<"one pair"<<endl;
}
else if((a[3]==a[4]-1)&&(a[1]==a[2]-1)&&(a[2]==a[3]-1)&&((a[0]==a[1]-1)||(a[4]==13&&a[0]==1)))
cout<<"straight"<<endl;
else cout<<"null"<<endl;
}
}
|
a.cc: In function 'int main()':
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(a,a+5);
| ^~~~
| short
|
s527841091
|
p00038
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stdio.h>
#include <sstream>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,s,n) for(int i=s; i<n; i++)
#define ALL(x) x.begin(), x.end()
#define pb push_back
#define foreach(it,con) for(auto it=con.begin();it!=con.end();it++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
string judge(int[] nums){
set<int> st;
map<int,int> count;
FOR(i,1,14){
count[i] = 0;
}
rep(i,5){
st.insert(nums[i]);
count[nums[i]]++;
}
bool is2 = false;
bool is3 = false;
int c=0;
int mc=0;
foreach(it,count){
if(*it>0){
c++; mc=max(mc,c);
}else{
c=0;
}
if(*it==4){
return "four card";
}else if(*it==3){
is3 = true;
}else if(*it==2){
if(is3){
return "full house";
}else if(is2){
return "two pair";
}else{
is2 = true;
}
}
}
if(mc==5){
return "straight";
}
if(is3){
return "three card";
}else if(is2){
return "one pair";
}
return "null";
}
int main(){
int nums[5];
while(scanf("%d,%d,%d,%d,%d",&nums[0],&nums[1],&nums[2],&nums[3],&nums[4])+1){
cout << judge(nums) << endl;
}
return 0;
}
|
a.cc:26:20: error: expected ',' or '...' before 'nums'
26 | string judge(int[] nums){
| ^~~~
a.cc: In function 'std::string judge(int*)':
a.cc:33:27: error: 'nums' was not declared in this scope
33 | st.insert(nums[i]);
| ^~~~
a.cc:42:23: error: no match for 'operator>' (operand types are 'std::pair<const int, int>' and 'int')
42 | if(*it>0){
| ~~~^~
| | |
| | int
| std::pair<const int, int>
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
42 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
42 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
42 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
42 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
42 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
42 | if(*it>0){
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
42 | if(*it>0){
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
42 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
42 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
42 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: mismatched types 'const _CharT*' and 'std::pair<const int, int>'
42 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::tuple<_UTypes ...>'
42 | if(*it>0){
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::vector<_Tp, _Alloc>'
42 | if(*it>0){
| ^
In file included from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/queue:62,
from a.cc:8:
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2349 | operator>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::deque<_Tp, _Alloc>'
42 | if(*it>0){
| ^
In file included from /usr/include/c++/14/queue:66:
/usr/include/c++/14/bits/stl_queue.h:411:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)'
411 | operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:411:5: note: template argument deduction/substitution failed:
a.cc:42:24: note: 'std::pair<const int, int>' is not derived from 'const std::queue<_Tp, _Seq>'
42 | if(*it>0){
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:9:
/usr/include/c++/14/bits/stl_map.h:1564:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc
|
s939721740
|
p00038
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stdio.h>
#include <sstream>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,s,n) for(int i=s; i<n; i++)
#define ALL(x) x.begin(), x.end()
#define pb push_back
#define foreach(it,con) for(auto it=con.begin();it!=con.end();it++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
string judge(int* nums){
set<int> st;
map<int,int> count;
FOR(i,1,14){
count[i] = 0;
}
rep(i,5){
st.insert(nums[i]);
count[nums[i]]++;
}
bool is2 = false;
bool is3 = false;
int c=0;
int mc=0;
foreach(it,count){
if(*it>0){
c++;
mc=max(mc,c);
}else{
c=0;
}
if(*it==4){
return "four card";
}else if(*it==3){
is3 = true;
}else if(*it==2){
if(is3){
return "full house";
}else if(is2){
return "two pair";
}else{
is2 = true;
}
}
}
if(mc==5){
return "straight";
}
if(is3){
return "three card";
}else if(is2){
return "one pair";
}
return "null";
}
int main(){
int nums[5];
while(scanf("%d,%d,%d,%d,%d",&nums[0],&nums[1],&nums[2],&nums[3],&nums[4])+1){
cout << judge(nums) << endl;
}
return 0;
}
|
a.cc: In function 'std::string judge(int*)':
a.cc:43:23: error: no match for 'operator>' (operand types are 'std::pair<const int, int>' and 'int')
43 | if(*it>0){
| ~~~^~
| | |
| | int
| std::pair<const int, int>
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(*it>0){
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(*it>0){
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'const _CharT*' and 'std::pair<const int, int>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::tuple<_UTypes ...>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::vector<_Tp, _Alloc>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/queue:62,
from a.cc:8:
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2349 | operator>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::deque<_Tp, _Alloc>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/queue:66:
/usr/include/c++/14/bits/stl_queue.h:411:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)'
411 | operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:411:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::queue<_Tp, _Seq>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:9:
/usr/include/c++/14/bits/stl_map.h:1564:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
1564 | operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1564:5: note: template
|
s068164972
|
p00038
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stdio.h>
#include <sstream>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,s,n) for(int i=s; i<n; i++)
#define ALL(x) x.begin(), x.end()
#define pb push_back
#define foreach(it,con) for(auto it=con.begin();it!=con.end();it++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
string judge(int* nums){
set<int> st;
map<int,int> count;
FOR(i,1,14){
count[i] = 0;
}
rep(i,5){
st.insert(nums[i]);
count[nums[i]]++;
}
bool is2 = false;
bool is3 = false;
int c=0;
int mc=0;
for(auto it=count.begin();it!=count.end();it++){
if(*it>0){
c++;
mc=max(mc,c);
}else{
c=0;
}
if(*it==4){
return "four card";
}else if(*it==3){
is3 = true;
}else if(*it==2){
if(is3){
return "full house";
}else if(is2){
return "two pair";
}else{
is2 = true;
}
}
}
if(mc==5){
return "straight";
}
if(is3){
return "three card";
}else if(is2){
return "one pair";
}
return "null";
}
int main(){
int nums[5];
while(scanf("%d,%d,%d,%d,%d",&nums[0],&nums[1],&nums[2],&nums[3],&nums[4])+1){
cout << judge(nums) << endl;
}
return 0;
}
|
a.cc: In function 'std::string judge(int*)':
a.cc:43:23: error: no match for 'operator>' (operand types are 'std::pair<const int, int>' and 'int')
43 | if(*it>0){
| ~~~^~
| | |
| | int
| std::pair<const int, int>
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(*it>0){
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(*it>0){
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'const _CharT*' and 'std::pair<const int, int>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::tuple<_UTypes ...>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::vector<_Tp, _Alloc>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/queue:62,
from a.cc:8:
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2349 | operator>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::deque<_Tp, _Alloc>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/queue:66:
/usr/include/c++/14/bits/stl_queue.h:411:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)'
411 | operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:411:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::queue<_Tp, _Seq>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:9:
/usr/include/c++/14/bits/stl_map.h:1564:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
1564 | operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1564:5: note: template
|
s344640023
|
p00038
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stdio.h>
#include <sstream>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,s,n) for(int i=s; i<n; i++)
#define ALL(x) x.begin(), x.end()
#define pb push_back
#define foreach(it,con) for(auto it=con.begin();it!=con.end();it++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
string judge(int* nums){
set<int> st;
map<int,int> count;
FOR(i,1,14){
count[i] = 0;
}
rep(i,5){
st.insert(nums[i]);
count[nums[i]]++;
}
bool is2 = false;
bool is3 = false;
int c=0;
int mc=0;
for(auto it=count.begin();it!=count.end();it++){
if(*it>0){
c++;
mc=max(mc,c);
}else{
c=0;
}
if(*it==4){
return "four card";
}else if(*it==3){
is3 = true;
}else if(*it==2){
if(is3){
return "full house";
}else if(is2){
return "two pair";
}else{
is2 = true;
}
}
}
if(mc==5){
return "straight";
}
if(is3){
return "three card";
}else if(is2){
return "one pair";
}
return "null";
}
int main(){
int nums[5];
while(scanf("%d,%d,%d,%d,%d",&nums[0],&nums[1],&nums[2],&nums[3],&nums[4])+1){
cout << judge(nums) << endl;
}
return 0;
}
|
a.cc: In function 'std::string judge(int*)':
a.cc:43:23: error: no match for 'operator>' (operand types are 'std::pair<const int, int>' and 'int')
43 | if(*it>0){
| ~~~^~
| | |
| | int
| std::pair<const int, int>
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(*it>0){
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(*it>0){
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'const _CharT*' and 'std::pair<const int, int>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::tuple<_UTypes ...>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::vector<_Tp, _Alloc>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/queue:62,
from a.cc:8:
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2349 | operator>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::deque<_Tp, _Alloc>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/queue:66:
/usr/include/c++/14/bits/stl_queue.h:411:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)'
411 | operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:411:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::queue<_Tp, _Seq>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:9:
/usr/include/c++/14/bits/stl_map.h:1564:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
1564 | operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1564:5: note: template
|
s326112861
|
p00038
|
C++
|
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stdio.h>
#include <sstream>
#include <stdlib.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define FOR(i,s,n) for(int i=s; i<n; i++)
#define ALL(x) x.begin(), x.end()
#define pb push_back
#define foreach(it,con) for(auto it=con.begin();it!=con.end();it++)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
string judge(int* nums){
set<int> st;
map<int,int> count;
FOR(i,1,14){
count[i] = 0;
}
rep(i,5){
st.insert(nums[i]);
count[nums[i]]++;
}
bool is2 = false;
bool is3 = false;
int c=0;
int mc=0;
foreach(it,count){
if(*it>0){
c++;
mc=max(mc,c);
}else{
c=0;
}
if(*it==4){
return "four card";
}else if(*it==3){
is3 = true;
}else if(*it==2){
if(is3){
return "full house";
}else if(is2){
return "two pair";
}else{
is2 = true;
}
}
}
if(mc==5){
return "straight";
}
if(is3){
return "three card";
}else if(is2){
return "one pair";
}
return "null";
}
int main(){
int nums[5];
while(scanf("%d,%d,%d,%d,%d",&nums[0],&nums[1],&nums[2],&nums[3],&nums[4])+1){
cout << judge(nums) << endl;
}
return 0;
}
|
a.cc: In function 'std::string judge(int*)':
a.cc:43:23: error: no match for 'operator>' (operand types are 'std::pair<const int, int>' and 'int')
43 | if(*it>0){
| ~~~^~
| | |
| | int
| std::pair<const int, int>
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(*it>0){
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
43 | if(*it>0){
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
43 | if(*it>0){
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: mismatched types 'const _CharT*' and 'std::pair<const int, int>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::tuple<_UTypes ...>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::vector<_Tp, _Alloc>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/deque:66,
from /usr/include/c++/14/queue:62,
from a.cc:8:
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const deque<_Tp, _Alloc>&, const deque<_Tp, _Alloc>&)'
2349 | operator>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:2349:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::deque<_Tp, _Alloc>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/queue:66:
/usr/include/c++/14/bits/stl_queue.h:411:5: note: candidate: 'template<class _Tp, class _Seq> bool std::operator>(const queue<_Tp, _Seq>&, const queue<_Tp, _Seq>&)'
411 | operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:411:5: note: template argument deduction/substitution failed:
a.cc:43:24: note: 'std::pair<const int, int>' is not derived from 'const std::queue<_Tp, _Seq>'
43 | if(*it>0){
| ^
In file included from /usr/include/c++/14/map:63,
from a.cc:9:
/usr/include/c++/14/bits/stl_map.h:1564:5: note: candidate: 'template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator>(const map<_Key, _Tp, _Compare, _Allocator>&, const map<_Key, _Tp, _Compare, _Allocator>&)'
1564 | operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_map.h:1564:5: note: template
|
s032733413
|
p00038
|
C++
|
import sys
def is_onepair(x):
for i in range(4):
if x.count(x[i]) == 2:
return True
return False
def is_twopair(x):
count = 0
for e in x:
for e2 in x:
if e == e2:
count += 1
if count == 2:
return True
return False
def is_threecard(x):
for i in range(3):
if x.count(x[i]) == 3:
return True
return False
def is_straight(x):
x.sort()
if x[0] == 1 and x[1:] = [10, 11, 12, 13]:
return True
for i in range(4):
if x[i]+1 != x[i+1]:
return False
return True
def is_fullhouse(x):
if is_threecard(x) and is_onepair(x):
return True
return False
def is_fourcard(x):
for i in range(2):
if x.count(x[i]) == 4:
return True
return False
for line in sys.stdin.readlines():
hand = list(map(int, line.split(',')))
if is_fourcard(hand):
print("four card")
elif is_fullhouse(hand):
print("full house")
elif is_straight(hand):
print("straight")
elif is_threecard(hand):
print("three card")
elif is_twopair(hand):
print("two pair")
elif is_onepair(hand):
print("one pair")
else:
print("null")
|
a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s750643858
|
p00038
|
C++
|
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
int main(void)
{
for(;;){
int n[5];
char c;
REP(i,5){
if(i) cin >> c;
if(cin >> n[i] == 0) return 0;
}
int num[16];
REP(i,16) num[i]=0;
REP(i,5) ++num[n[i]];
num[14]=num[1];
string s="null";
REP(i,11){
int st=0;
REP(j,5) if(num[i+j]) ++st;
if(st==5) s="straight";
}
int pa=0;
REP(i,5) REP(j,i) if(n[i]==n[j]) ++pa;
if(pa==1) s="one pair";
if(pa==2) s="two pair";
if(pa==3) s="three card";
if(pa==4) s="full house";
if(pa==6) s="four card";
cout << s << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:16:22: error: no match for 'operator==' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
16 | if(cin >> n[i] == 0) return 0;
| ~~~~~~~~~~~ ^~ ~
| | |
| | int
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:16:22: note: candidate: 'operator==(int, int)' (built-in)
16 | if(cin >> n[i] == 0) return 0;
| ~~~~~~~~~~~~^~~~
a.cc:16:22: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
16 | if(cin >> n[i] == 0) return 0;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
16 | if(cin >> n[i] == 0) return 0;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
16 | if(cin >> n[i] == 0) return 0;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
16 | if(cin >> n[i] == 0) return 0;
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:16:25: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>'
16 | if(cin >> n[i] == 0) return 0;
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 |
|
s919358353
|
p00038
|
C++
|
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
int main(void)
{
for(;;){
int n[5];
char c;
REP(i,5){
if(i) cin >> c;
if((cin >> n[i]) == 0) return 0;
}
int num[16];
REP(i,16) num[i]=0;
REP(i,5) ++num[n[i]];
num[14]=num[1];
string s="null";
REP(i,11){
int st=0;
REP(j,5) if(num[i+j]) ++st;
if(st==5) s="straight";
}
int pa=0;
REP(i,5) REP(j,i) if(n[i]==n[j]) ++pa;
if(pa==1) s="one pair";
if(pa==2) s="two pair";
if(pa==3) s="three card";
if(pa==4) s="full house";
if(pa==6) s="four card";
cout << s << endl;
}
}
|
a.cc: In function 'int main()':
a.cc:16:24: error: no match for 'operator==' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'int')
16 | if((cin >> n[i]) == 0) return 0;
| ~~~~~~~~~~~~~ ^~ ~
| | |
| | int
| std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:16:24: note: candidate: 'operator==(int, int)' (built-in)
16 | if((cin >> n[i]) == 0) return 0;
| ~~~~~~~~~~~~~~^~~~
a.cc:16:24: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
In file included from /usr/include/c++/14/regex:68,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
from a.cc:1:
/usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
1274 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
1441 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
1613 | operator==(const sub_match<_Bi_iter>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)'
2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1,
| ^~~~~~~~
/usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:16:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>'
16 | if((cin >> n[i]) == 0) return 0;
| ^
In file included from /usr/include/c++/14/string:43:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::ope
|
s760483863
|
p00038
|
C++
|
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
int n[5], num[14], pair[3],i;
while (scanf_s("%d,%d,%d,%d,%d",&n[0],&n[1],&n[2],&n[3],&n[4]) != EOF){
i = 0;
for (int i = 0; i < 14; i++) num[i] = 0;
for (int i = 0; i < 3; i++) pair[i] = 0;
for (int i = 0; i < 5; i++) num[n[i] - 1]++;
for (int i = 0; i < 13; i++){
if (num[i] > 1) pair[num[i] - 2]++;
}
if (pair[2]) cout << "four card" << endl;
else if (pair[0] && pair[1]) cout << "full house" << endl;
else if (pair[1]) cout << "three card" << endl;
else if (pair[0] == 2) cout << "two pair" << endl;
else if (pair[0]) cout << "one pair" << endl;
else{
num[13] = num[0];
for (i = 0; i < 10; i++){
if (num[i] == 1 && num[i] == num[i + 1] && num[i + 1] == num[i + 2] && num[i + 2] == num[i + 3] && num[i + 3] == num[i + 4]) {
cout << "straight" << endl;
break;
}
}
}
if (i == 10) cout << "null" << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:7:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
7 | while (scanf_s("%d,%d,%d,%d,%d",&n[0],&n[1],&n[2],&n[3],&n[4]) != EOF){
| ^~~~~~~
| scanf
|
s654036670
|
p00038
|
C++
|
def function(a,b,c,d,e):
A=[a,b,c,d,e]
A.sort()
if A[0]==A[3] or A[1]==A[4]:
print("four card")
elif (A[0]==A[1] and A[2]==A[4]) or (A[0]==A[2] and A[3]==A[4]):
print("full house")
elif A[0]==A[2] or A[1]==A[3] or A[2]==A[4]:
print("three card")
elif (A[0]==A[1] and A[2]==A[3]) or (A[0]==A[1] and A[3]==A[4]) or (A[1]==A[2] and A[3]==A[4]):
print("two pair")
elif A[0]==A[1] or A[1]==A[2] or A[2]==A[3] or A[3]==A[4]:
print("one pair")
elif A==[1,10,11,12,13]:
print("straight")
elif A[0]==A[1]-1==A[2]-2==A[3]-3==A[4]-4:
print("straight")
else:
print("null")
while True:
try:
a,b,c,d,e=map(int,input().split(','))
function(a,b,c,d,e)
except EOFError:
break
|
a.cc:1:1: error: 'def' does not name a type
1 | def function(a,b,c,d,e):
| ^~~
|
s620812513
|
p00038
|
C++
|
# -*- coding: utf-8 -*-
def is_four_card(d):
return 4 in d.values()
def is_full_house(d):
return 3 in d.values() and 2 in d.values()
def is_straight(d):
flag = [False, 0]
for i in d.values():
if flag[0] == True and flag[1] == 5:
return True
if i == 1:
flag[0] = True
flag[1] += 1
return False
def is_three_card(d):
return 3 in d.values()
def is_two_pair(d):
return list(d.values()).count(2) == 2
def is_one_pair(d):
return list(d.values()).count(2) == 1
def judge(d):
if is_four_card(d):
print('four card')
elif is_full_house(d):
print('full house')
elif is_straight(d):
print('straight')
elif is_three_card(d):
print('three card')
elif is_two_pair(d):
print('two pair')
elif is_one_pair(d):
print('one pair')
else:
print('null')
def solve(cards):
d = {k: 0 for k in range(1, 14)}
for card in cards:
d[card] += 1
judge(d)
_input = input().split(",")
solve(_input)
|
a.cc:1:3: error: invalid preprocessing directive #-
1 | # -*- coding: utf-8 -*-
| ^
a.cc:38:15: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
38 | print('four card')
| ^~~~~~~~~~~
a.cc:40:15: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
40 | print('full house')
| ^~~~~~~~~~~~
a.cc:42:15: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
42 | print('straight')
| ^~~~~~~~~~
a.cc:44:15: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
44 | print('three card')
| ^~~~~~~~~~~~
a.cc:46:15: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
46 | print('two pair')
| ^~~~~~~~~~
a.cc:48:15: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
48 | print('one pair')
| ^~~~~~~~~~
a.cc:50:15: warning: multi-character character constant [-Wmultichar]
50 | print('null')
| ^~~~~~
a.cc:4:1: error: 'def' does not name a type
4 | def is_four_card(d):
| ^~~
a.cc:55:5: error: expected unqualified-id before 'for'
55 | for card in cards:
| ^~~
|
s445289694
|
p00038
|
C++
|
#include <iostream>
#include <string>
using namespace std;
#define ??????????????£?????? 114514
string pairs[2][3] = { {"null","one pair","two pair"},
{"three card","full house",""} };
int main() {
int n, c, three, two;
char t;
string res;
while (!cin.eof()) {
int card[13] = { 0 }, c = 0, three = 0, two = 0;
for (int i = 0; i < 4; i++) {
cin >> n >> t;
card[n - 1]++;
}
cin >> n;
card[n - 1]++;
for (int i = 0; i < 13; i++) {
if (card[i] == 4) {
c = ??????????????£??????;
break;
} else if(card[i] == 3) {
three++;
} else if(card[i] == 2) {
two++;
}
if (card[i] == 1) {
c++;
if (c == 4 && i == 12 && card[0] == 1) {
c = 5;
break;
}
} else if(card[i] == 0 && c != 5 && c > 0) {
c = 0;
}
}
if (c == 5) {
cout << "straight" << endl;
continue;
}
if (c == ??????????????£??????) {
cout << "four card" << endl;
continue;
}
cout << pairs[three][two] << endl;
}
return 0;
}
|
a.cc:5:9: error: macro names must be identifiers
5 | #define ??????????????£?????? 114514
| ^
a.cc:5:23: error: extended character £ is not valid in an identifier
5 | #define ??????????????£?????? 114514
| ^
a.cc:25:51: error: extended character £ is not valid in an identifier
25 | c = ??????????????£??????;
| ^
a.cc:49:40: error: extended character £ is not valid in an identifier
49 | if (c == ??????????????£??????) {
| ^
a.cc:49:45: warning: trigraph ??) ignored, use -trigraphs to enable [-Wtrigraphs]
49 | if (c == ??????????????£??????) {
a.cc: In function 'int main()':
a.cc:25:37: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:38: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:39: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:40: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:41: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:42: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:43: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:44: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:45: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:46: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:47: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:48: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:49: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:50: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:51: error: '\U000000a3' was not declared in this scope
25 | c = ??????????????£??????;
| ^
a.cc:25:53: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:54: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:55: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:56: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:57: error: expected primary-expression before '?' token
25 | c = ??????????????£??????;
| ^
a.cc:25:58: error: expected primary-expression before ';' token
25 | c = ??????????????£??????;
| ^
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
| ^
| :
a.cc:25:58: error: expected primary-expression before ';' token
a.cc:25:58: error: expected ':' before ';' token
25 | c = ??????????????£??????;
|
s381040473
|
p00038
|
C++
|
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int check(vector<int> v) {
sort(v.begin(), v.end());
//for (int i = 0; i < v.size(); i++)cout << v[i] << " ";
if ((v[0] == v[1] && v[1] == v[2] && v[2]== v[3]) || (v[1] == v[2] && v[2]== v[3] && v[3] == v[4])) {//four cards
return 1;
}
else if (((v[0] == v[1] && v[1] == v[2]) && (v[3] == v[4])) || ((v[0] == v[1]) && (v[2] == v[3] && v[3] == v[4]))) {//full house
return 2;
}
else if (v[0] == v[1] - 1 && v[0] == v[2] - 2 && v[0] == v[3] - 3 && v[0] == v[4] - 4) {//straight
return 3;
}
else if (v[0]==1 && v[1]==10 && v[2]==11 && v[3] == 12 && v[4] == 13) {//straight
return 3;
}
else if (((v[0] == v[1] && v[1] == v[2]) || (v[1] == v[2] && v[2] == v[3])) || ((v[2] == v[3] && v[3] == v[4]))) {//three cards
return 4;
}
else if ((v[0] == v[1] && v[2] == v[3]) || (v[0] == v[1] && v[3] == v[4]) || (v[1] == v[2] && v[3] == v[4])) {//two pair
return 5;
}
else if ((v[0] == v[1]) || (v[1] == v[2]) || (v[2] == v[3]) || (v[3] == v[4])) {//one pair
return 6;
}
else {
return 7;
}
}
int main()
{
vector<int> v;
int a, b, c, d, e;
while (scanf_s("%d,%d,%d,%d,%d", &a, &b, &c, &d, &e) != EOF) {
v.clear();
v.push_back(a);
v.push_back(b);
v.push_back(c);
v.push_back(d);
v.push_back(e);
switch (check(v)) {
case 1:cout << "four cards" << endl; break;
case 2:cout << "full house" << endl; break;
case 3:cout << "straight" << endl; break;
case 4:cout << "three card" << endl; break;
case 5:cout << "two pair" << endl; break;
case 6:cout << "one pair" << endl; break;
case 7:cout << "null" << endl; break;
default:cout << "Error" << endl; break;
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:42:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
42 | while (scanf_s("%d,%d,%d,%d,%d", &a, &b, &c, &d, &e) != EOF) {
| ^~~~~~~
| scanf
|
s362693528
|
p00038
|
C++
|
while 1:
try: p=sorted(list(map(int,input().split(','))))
except: break
if (p[0] == p[3]) or (p[1] == p[4]):
print('four card')
elif p[0] == p[2] or p[1] == p[3] or p[2] == p[4]:
print('three card')
elif (p[0] == p[1] == p[2] and p[3] == p[4]) or (p[0] == [1] and p[2] == p[3] == p[4]):
print('full house')
elif (p[0] == p[1] and p[2] == p[3]) or (p[1] == p[2] and p[3] == p[4]):
print('two pair')
elif p[0] == p[1] or p[1] == p[2] or p[3] == p[4]:
print('one pair')
elif p[0] == p[1]-1 and p[1] == p[2]-1 and p[2] == p[3]-1 and p[3] == p[4]-1 and p[4] == p[3]+1:
print('straight')
elif p[0] == 1 and p[1] == 10 and p[2] == 11 and p[3] == 12 and p[4] == 13:
print('straight')
else:
print('null')
|
a.cc:5:23: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
5 | print('four card')
| ^~~~~~~~~~~
a.cc:7:23: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
7 | print('three card')
| ^~~~~~~~~~~~
a.cc:9:23: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
9 | print('full house')
| ^~~~~~~~~~~~
a.cc:11:23: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
11 | print('two pair')
| ^~~~~~~~~~
a.cc:13:23: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
13 | print('one pair')
| ^~~~~~~~~~
a.cc:15:23: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
15 | print('straight')
| ^~~~~~~~~~
a.cc:17:23: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
17 | print('straight')
| ^~~~~~~~~~
a.cc:19:23: warning: multi-character character constant [-Wmultichar]
19 | print('null')
| ^~~~~~
a.cc:1:1: error: expected unqualified-id before 'while'
1 | while 1:
| ^~~~~
|
s579734234
|
p00038
|
C++
|
afga
|
a.cc:1:1: error: 'afga' does not name a type
1 | afga
| ^~~~
|
s400286308
|
p00038
|
C++
|
#include<iostream>
#include<array>
int main()
{
while (true)
{
int a, b, c, d, e;
char foo;
std::cin >> a >> foo >> b >> foo >> c >> foo >> d >> foo >> e;
if (std::cin.eof())
{
break;
}
std::array<int, 5>num = { a,b,c,d,e };
std::sort(num.begin(), num.end());
if (num[0] == num[3] || num[1] == num[4])
{
std::cout << "four card" << std::endl;
}
else if (num[0] == num[1] && num[2] == num[4] || num[0] == num[2] && num[3] == num[4])
{
std::cout << "full house" << std::endl;
}
else if (num[2] == num[1] + 1 && num[3] == num[1] + 2 && num[4] == num[1] + 3 && (num[0] == num[1] - 1 || num[0] == 1 && num[1] == 10))
{
std::cout << "straight" << std::endl;
}
else if (num[0]==num[2]||num[1]==num[3]||num[2]==num[4])
{
std::cout << "three card" << std::endl;
}
else
{
int pair = 0;
for (int i = 0; i < 4; i++)
{
if (num[i] == num[i + 1])
{
pair++;
}
}
switch (pair)
{
case 2:
std::cout << "two pair" << std::endl;
break;
case 1:
std::cout << "one pair" << std::endl;
break;
case 0:
std::cout << "null" << std::endl;
break;
}
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:22: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
15 | std::sort(num.begin(), num.end());
| ^~~~
| qsort
|
s359607561
|
p00038
|
C++
|
#include<iostream>
#include<stdio.h>
#include<vector>
#include<utility>
#include<queue>
#include<math.h>
#include<string>
#include<stack>
#include<typeinfo>
using namespace std;
typedef pair<int, int> P;
int main() {
char ch, straight, four, three, twop, onep;
int check[5] = { 1,10,11,12,13 }, st = 0;
int card[5]; while (cin >> card[0] >> ch >> card[1] >> ch >> card[2] >> ch >> card[3] >> ch >> card[4]) {
int cnt[14] = { 0 };
sort(card, card + 5);
four = false;
three = false;
twop = false;
onep = false;
straight = true;
st = 0;
for (int i = 0; i < 5; ++i) {
if (i != 0 && card[i - 1] + 1 != card[i])straight = false;
if (card[i] == check[i])st++;
cnt[card[i]]++;
}
if (st == 5)straight = true;
for (int i = 0; i < 5; ++i) {
if (i != 0 && card[i - 1] == card[i])continue;
if (cnt[card[i]] == 4) {
four = true;
break;
}
else if (cnt[card[i]] == 3) three = true;
else if (cnt[card[i]] == 2 && onep)twop = true;
else if (cnt[card[i]] == 2)onep = true;
}
if (four)cout << "four card" << endl;
else if (onep&&three)cout << "full house" << endl;
else if (straight)cout << "straight" << endl;
else if (three)cout << "three card" << endl;
else if (twop)cout << "two pair" << endl;
else if (onep)cout << "one pair" << endl;
else cout << "null" << endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
17 | sort(card, card + 5);
| ^~~~
| sqrt
|
s774565946
|
p00038
|
C++
|
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int a[5];
bool isStraight(){
vector<int> n;
for(int i=0 ; i<5 ; i++){
n.push_back(a[i]);
}
sort( n.begin(), n.end() );
if( n[0]+1 == n[1] && n[1]+1 == n[2] && n[2]+1 == n[3] && n[3]+1 == n[4]){
return true;
}
if( n[0]==1 && n[1]==10 && n[2]==11 && n[3]==12 && n[4]==13){
return true;
}
return false;
}
string checkCard(){
int n, count, c[5];
int c2=0, c3=0, c4=0;
for(int j=0 ; j<5 ; j++){
count = 0;
n = a[j];
for(int i=0 ; i<5 ; i++){
if(a[i]==n)count++;
}
c[j] = count;
}
for(int i=0 ; i<5 ; i++){
if(c[i]==2)c2++;
if(c[i]==3)c3++;
if(c[i]==4)c4++;
}
if(c4==4) return "four card";
else if(c3==3 && c2==2) return "full house";
else if( isStraight() ) return "straight";
else if(c3==3) return "three card";
else if(c2==4) return "two pair";
else if(c2==2) return "one pair";
else return "null";
}
int main(){
while( scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4] ) != EOF ){
cout << checkCard() << endl;
}
return 0;
}
|
a.cc: In function 'bool isStraight()':
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
13 | sort( n.begin(), n.end() );
| ^~~~
| short
|
s669672049
|
p00038
|
C++
|
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int a[5];
bool isStraight(){
vector<int> n;
for(int i=0 ; i<5 ; i++){
n.push_back(a[i]);
}
sort( n.begin(), n.end() );
if( n[0]+1 == n[1] && n[1]+1 == n[2] && n[2]+1 == n[3] && n[3]+1 == n[4]){
return true;
}
if( n[0]==1 && n[1]==10 && n[2]==11 && n[3]==12 && n[4]==13){
return true;
}
return false;
}
string checkCard(){
int n, count, c[5];
int c2=0, c3=0, c4=0;
for(int j=0 ; j<5 ; j++){
count = 0;
n = a[j];
for(int i=0 ; i<5 ; i++){
if(a[i]==n)count++;
}
c[j] = count;
}
for(int i=0 ; i<5 ; i++){
if(c[i]==2)c2++;
if(c[i]==3)c3++;
if(c[i]==4)c4++;
}
if(c4==4) return "four card";
else if(c3==3 && c2==2) return "full house";
else if( isStraight() ) return "straight";
else if(c3==3) return "three card";
else if(c2==4) return "two pair";
else if(c2==2) return "one pair";
else return "null";
}
int main(){
string str;
char s[80];
while( scanf("%d,%d,%d,%d,%d", &a[0], &a[1], &a[2], &a[3], &a[4] ) != EOF ){
str = checkCard();
printf("%s\n",str.c_str());
}
return 0;
}
|
a.cc: In function 'bool isStraight()':
a.cc:14:9: error: 'sort' was not declared in this scope; did you mean 'short'?
14 | sort( n.begin(), n.end() );
| ^~~~
| short
|
s672060411
|
p00038
|
C++
|
#include <stdio.h>
int compare_int (const void* a,const void* b) {
return (*(int*)a-*(int*)b);
}
int main(void) {
int hand[5];
int overlap[5];
int used[5];
int count;
int full_or_three=-1;
int two_or_one=-1;
int temp;
int i,j,k,l,m=0;
char c;
while(scanf("%d,%d,%d,%d,%d",&hand[0],&hand[1],&hand[2],&hand[3],&hand[4])!=EOF) {
//sort current hand
qsort(hand,sizeof(hand)/sizeof(hand[0]),sizeof(int),compare_int);
//for(i=0;i<5;i++) printf("%d ",hand[i]);
//count overlapped cards
count=0;
for(i=0;i<5;i++) {
overlap[i]=0;
used[i]=0;
}
for(i=0;i<4;i++) {
if(used[i]==1) continue;
for(j=i+1;j<5;j++) {
if(used[j]==0 && hand[i]==hand[j]) {
overlap[count]++;
used[i]=used[j]=1;
}
}
used[i]=1;
count++;
}
//for(i=0;i<5;i++) printf("%d ",overlap[i]);
//check overlapped cards
//four card?
for(i=0;i<5;i++) {
if(overlap[i]==3) {
printf("four card\n");
goto Terminate;
}
}
//full house or three card?
for(i=0;i<5;i++) {
if(overlap[i]==2) {
for(j=0;j<5;j++) {
if(overlap[j]==1) {
printf("full house\n");
goto Terminate;
}
}
printf("three card\n");
goto Terminate;
}
}
if(full_or_three==1) {
for(i=0;i<5;i++) {
if(overlap[i]==1) {
printf("full house\n");
goto Terminate;
}
else {
printf("three card\n");
goto Terminate;
}
}
}
//straight?
if(hand[0]+1==hand[1] && hand[1]+1==hand[2] && hand[2]+1==hand[3] && hand[3]+1==hand[4] || (hand[0]==1 && hand[1]==10 && hand[2]==11 && hand[3]==12 && hand[4]==13)) {
printf("straight\n");
goto Terminate;
}
//two pair or one pair?
for(i=0;i<4;i++) {
if(overlap[i]==1) {
for(j=i+1;j<5;j++) {
if(overlap[j]==1) {
printf("two pair\n");
goto Terminate;
}
}
printf("one pair\n");
goto Terminate;
}
}
//null
printf("null\n");
Terminate:
continue;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:27:5: error: 'qsort' was not declared in this scope
27 | qsort(hand,sizeof(hand)/sizeof(hand[0]),sizeof(int),compare_int);
| ^~~~~
|
s732373867
|
p00038
|
C++
|
#include <stdio.h>
int compare_int (const void* a,const void* b) {
return (*(int*)a-*(int*)b);
}
int main(void) {
int hand[5];
int overlap[5];
int used[5];
int count;
int full_or_three=-1;
int two_or_one=-1;
int temp;
int i,j,k,l,m=0;
char c;
while(scanf("%d,%d,%d,%d,%d",&hand[0],&hand[1],&hand[2],&hand[3],&hand[4])!=EOF) {
//sort current hand
qsort(hand,sizeof(hand)/sizeof(hand[0]),sizeof(int),compare_int);
//for(i=0;i<5;i++) printf("%d ",hand[i]);
//count overlapped cards
count=0;
for(i=0;i<5;i++) {
overlap[i]=0;
used[i]=0;
}
for(i=0;i<4;i++) {
if(used[i]==1) continue;
for(j=i+1;j<5;j++) {
if(used[j]==0 && hand[i]==hand[j]) {
overlap[count]++;
used[i]=used[j]=1;
}
}
used[i]=1;
count++;
}
//for(i=0;i<5;i++) printf("%d ",overlap[i]);
//check overlapped cards
//four card?
for(i=0;i<5;i++) {
if(overlap[i]==3) {
printf("four card\n");
goto Terminate;
}
}
//full house or three card?
for(i=0;i<5;i++) {
if(overlap[i]==2) {
for(j=0;j<5;j++) {
if(overlap[j]==1) {
printf("full house\n");
goto Terminate;
}
}
printf("three card\n");
goto Terminate;
}
}
if(full_or_three==1) {
for(i=0;i<5;i++) {
if(overlap[i]==1) {
printf("full house\n");
goto Terminate;
}
else {
printf("three card\n");
goto Terminate;
}
}
}
//straight?
if(hand[0]+1==hand[1] && hand[1]+1==hand[2] && hand[2]+1==hand[3] && hand[3]+1==hand[4] || (hand[0]==1 && hand[1]==10 && hand[2]==11 && hand[3]==12 && hand[4]==13)) {
printf("straight\n");
goto Terminate;
}
//two pair or one pair?
for(i=0;i<4;i++) {
if(overlap[i]==1) {
for(j=i+1;j<5;j++) {
if(overlap[j]==1) {
printf("two pair\n");
goto Terminate;
}
}
printf("one pair\n");
goto Terminate;
}
}
//null
printf("null\n");
Terminate:
continue;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:27:5: error: 'qsort' was not declared in this scope
27 | qsort(hand,sizeof(hand)/sizeof(hand[0]),sizeof(int),compare_int);
| ^~~~~
|
s804574011
|
p00038
|
C++
|
#include<iostream>
#include<cstdio>
#include<stdlib>
using namespace std;
int max(const void* x,const void* y);
int main(){
for(;;){
int hand[5];
if(scanf("%d,%d,%d,%d,%d",&hand[0],&hand[1],&hand[2],&hand[3],&hand[4]) == EOF){break;}
qsort(hand,5,sizeof(int),max);
int f = 0;
for(int i=0; i<5; i++){
if(hand[i] == hand[i+1] && hand[i+1] == hand[i+2] && hand[i+2] == hand[i+3]){f = 1;i+=3;}
else if(hand[i] == hand[i+1] && hand[i+1] == hand[i+2]){f += 2;i+=2;}
else if(hand[i] == hand[i+1]){f += 3;i+=1;}
}
if(hand[0]+1 == hand[1] && hand[1]+1 == hand[2] && hand[2]+1 == hand[3] && hand[3]+1 == hand[4]){f = 10;}
if(hand[0] == 1 && hand[1] == 10 && hand[2] == 11 && hand[3] == 12 && hand[4] == 13){f = 10;}
if(f == 1){cout <<"four card"<<endl;}
else if(f == 2){cout <<"three card"<<endl;}
else if(f == 3){cout <<"one pair"<<endl;}
else if(f == 6){cout <<"two pair"<<endl;}
else if(f == 5){cout <<"full house"<<endl;}
else if(f == 10){cout <<"straight"<<endl;}
else if(f == 0){cout <<"null"<<endl;}
}
return 0;
}
int max(const void* x,const void* y){
return *(int*)x - *(int*)y;
}
|
a.cc:3:9: fatal error: stdlib: No such file or directory
3 | #include<stdlib>
| ^~~~~~~~
compilation terminated.
|
s801428921
|
p00038
|
C++
|
#include<iostream>
#include<cstdio>
#include<stdlib>
using namespace std;
int max(const void* x,const void* y);
int main(){
for(;;){
int hand[5];
if(scanf("%d,%d,%d,%d,%d",&hand[0],&hand[1],&hand[2],&hand[3],&hand[4]) == EOF){break;}
qsort(hand,5,sizeof(int),max);
int f = 0;
for(int i=0; i<5; i++){
if(hand[i] == hand[i+1] && hand[i+1] == hand[i+2] && hand[i+2] == hand[i+3]){f = 1;i+=3;}
else if(hand[i] == hand[i+1] && hand[i+1] == hand[i+2]){f += 2;i+=2;}
else if(hand[i] == hand[i+1]){f += 3;i+=1;}
}
if(hand[0]+1 == hand[1] && hand[1]+1 == hand[2] && hand[2]+1 == hand[3] && hand[3]+1 == hand[4]){f = 10;}
if(hand[0] == 1 && hand[1] == 10 && hand[2] == 11 && hand[3] == 12 && hand[4] == 13){f = 10;}
if(f == 1){cout <<"four card"<<endl;}
else if(f == 2){cout <<"three card"<<endl;}
else if(f == 3){cout <<"one pair"<<endl;}
else if(f == 6){cout <<"two pair"<<endl;}
else if(f == 5){cout <<"full house"<<endl;}
else if(f == 10){cout <<"straight"<<endl;}
else if(f == 0){cout <<"null"<<endl;}
}
return 0;
}
int max(const void* x,const void* y){
return *(int*)x - *(int*)y;
}
|
a.cc:3:9: fatal error: stdlib: No such file or directory
3 | #include<stdlib>
| ^~~~~~~~
compilation terminated.
|
s203502672
|
p00038
|
C++
|
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void){
int x[5],card[14],fg[5],i;
vector<int>y;
while(~scanf("%d,%d,%d,%d,%d"
,&x[0],&x[1],&x[2],&x[3],&x[4])){
memset(card,0,sizeof(card));
memset(fg,0,sizeof(fg));
for(i=0;i<5;i++)card[x[i]]++;
for(i=1;i<14;i++){
if(card[i]==2 && fg[0]==0)fg[0]=1;
else if(card[i]==2 && fg[0]==1){
fg[0]=0;
cout <<"two pair" << endl;
fg[2]=1;
break;
}
else if(card[i]==3 && fg[0]!=1)fg[3]=1;
else if(card[i]==3 && fg[0]==1){
fg[0]=0;
cout << "full house" << endl;
fg[2]=1;
break;
}
else if(card[i]==4){
cout << "four card" << endl;
fg[2]=1;
break;
}
}
if(fg[0]==1){
cout << "one pair" << endl;
fg[2]=1;
}
else if(fg[3]==1){
cout << "three card" << endl;
fg[2]=1;
}
for(i=0;i<5;i++)y.push_back(x[i]);
sort(y.begin(),y.end());
for(i=1;i<4;i++)if(y[i]+1!=y[i+1])fg[4]=1;
if(!fg[4] && !fg[2]){
cout << "straight" <<endl;
fg[2]=1;
}
if(fg[2]==0)cout <<"null"<<endl;
y.clear();
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:5: error: 'memset' was not declared in this scope
14 | memset(card,0,sizeof(card));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<cstdio>
+++ |+#include <cstring>
5 |
|
s101079982
|
p00038
|
C++
|
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main(void){
int x[5],card[14],fg[5],i;
vector<int>y;
while(~scanf("%d,%d,%d,%d,%d"
,&x[0],&x[1],&x[2],&x[3],&x[4])){
memset(card,0,sizeof(card));
memset(fg,0,sizeof(fg));
for(i=0;i<5;i++)card[x[i]]++;
for(i=1;i<14;i++){
if(card[i]==2 && fg[0]==0)fg[0]=1;
else if(card[i]==2 && fg[0]==1){
fg[0]=0;
cout <<"two pair" << endl;
fg[2]=1;
break;
}
else if(card[i]==3 && fg[0]!=1)fg[3]=1;
else if(card[i]==3 && fg[0]==1){
fg[0]=0;
cout << "full house" << endl;
fg[2]=1;
break;
}
else if(card[i]==4){
cout << "four card" << endl;
fg[2]=1;
break;
}
}
if(fg[0]==1){
cout << "one pair" << endl;
fg[2]=1;
}
else if(fg[3]==1){
cout << "three card" << endl;
fg[2]=1;
}
for(i=0;i<5;i++)y.push_back(x[i]);
sort(y.begin(),y.end());
for(i=1;i<4;i++)if(y[i]+1!=y[i+1])fg[4]=1;
if(!fg[4] && !fg[2]){
cout << "straight" <<endl;
fg[2]=1;
}
if(fg[2]==0)cout <<"null"<<endl;
y.clear();
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:15:5: error: 'memset' was not declared in this scope
15 | memset(card,0,sizeof(card));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include<cstdlib>
+++ |+#include <cstring>
6 |
|
s650868777
|
p00038
|
C++
|
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
string yaku[]={"one pair","two pair","three card","full house","four card","straight","null"};
int tefuda[5],count[14];
bool flag,straight;
while(scanf("%d,%d,%d,%d,%d",&tefuda[0],&tefuda[1],&tefuda[2],&tefuda[3],&tefuda[4])!=EOF){
flag=true;
straight=true;
memset(count,0,sizeof(count));
//sort
sort(tefuda,tefuda+5);
//1-4 pair or fullhouse
for(int i=0;i<4;i++){
for(int j=i+1;j<5;j++){
if(tefuda[i]==tefuda[j]){
count[tefuda[i]]++;
flag=false;
}
}
}
//straight
if(flag){
if(tefuda[0]==1 && tefuda[1]==2){
for(int i=2;i<5;i++){
if(tefuda[i]!=i+1){
straight=false;
}
}
}
else if(tefuda[0]==1 && tefuda[4]==13){
for(int i=1;i<4;i++){
if(tefuda[i]!=i+9){
straight=false;
}
}
}
else{
for(int i=tefuda[0];i<5+tefuda[0];i++){
if(tefuda[i-tefuda[0]]!=i){
straight=false;
}
}
}
if(straight){
cout<<yaku[5]<<endl; //straight
//break;
}
else{
cout<<yaku[6]<<endl; //null
//break;
}
}
else{
sort(count,count+14);
if(count[13]==6){
cout<<yaku[4]<<endl;
}else if(count[12]==1 && count[13]==3){
cout<<yaku[3]<<endl;
}else if(count[12]==0 && count[13]==3){
cout<<yaku[2]<<endl;
}else if(count[12]==count[13]){
cout<<yaku[1]<<endl;
}else if(count[12]<2 && count[13]==1){
cout<<yaku[0]<<endl;
}
}
}
}
|
a.cc: In function 'int main()':
a.cc:18:17: error: 'memset' was not declared in this scope
18 | memset(count,0,sizeof(count));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 |
|
s773200461
|
p00038
|
C++
|
#include<cstdio>
#include<algorithm>
using namespace std;
int cards[5];
int card[14]={0};
int main()
{
start:
while(scanf("%d,%d,%d,%d,%d",&cards[0],&cards[1],&cards[2],&cards[3],&cards[4])!=EOF)
{
fill(card,card+14,0);
for(int i=0;i<5;i++)
{
card[cards[i]-1]++;
if(cards[i]==1)card[13]++;
}
for(int i=0;i<13;i++)
{
if(card[i]==4)
{
printf("four card\n");
goto start;
}
if(card[i]==3)
{
for(int j=0;j<13;j++)
{
if(card[j]==2)
{
printf("full house\n");
goto start;
}
}
printf("three card\n");
goto start;
}
}
int flag=0;
for(int i=0;i<13;i++)
{
if(card[i]==2)flag++;
}
if(flag==2)
{
printf("two pair\n");
goto start;
}
if(flag==1)
{
printf("one pair\n");
goto start;
}
for(int i=0;i<14;i++)
{
int k=1;
for(int j=0;j<5;j++)
{
k*=card[i+j];
}
if(k==1)
{
printf("straight\n");
goto start;
}
}
printf("null\n");
goto start;
}
return 0;
}
|
a.cc:73:1: error: extended character is not valid in an identifier
73 | return 0;
| ^
a.cc:73:1: error: extended character is not valid in an identifier
a.cc:73:1: error: extended character is not valid in an identifier
a.cc:73:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:73:1: error: '\U00003000\U00003000\U00003000\U00003000return' was not declared in this scope
73 | return 0;
| ^~~~~~~~~~~~~~
|
s441580026
|
p00038
|
C++
|
#include<algorithm>
#include<stdio.h>
int main()
{
int card[5];
while( scanf( "%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4] ) != EOF ){
int a[20];
std::fill( a, a + 20, 0 );
int c = 0;
for( int i = 0; i < 5; i++ ) a[card[i]]++;
for( int i = 0; i < 5; i++ ){
c = std::max( c, std::count( card, card + 5, card[i] ) );
}
bool f = false;
int m;
switch( c ){
case 4:
puts( "four card" );
break;
case 3:
for( int i = 0; i < 5; i++ ){
if( std::count( card, card + 5, card[i] ) == 2 ){
f = true;
break;
}
}
if( f ){
puts( "full house" );
}
else{
puts( "three card" );
}
break;
case 2:
for( int i = 0; i < 5; i++ ){
if( std::count( card, card + 5, card[i] ) == 2 && !f ){
m = card[i];
f = true;
}
if( card[i] != m && std::count( card, card + 5, card[i] ) == 2 && f ){
puts( "two pair" );
goto end;
}
}
puts( "one pair" );
break;
case 1:
for( int i = 1; i <= 10; i++ ){
if( a[i] == 1 && a[i+1] == 1 && a[i+2] == 1 && a[i+3] == 1 && a[(i+4)%13] == 1 ) f = true;
}
if( f ){
puts( "straight" );
}
else{
puts( "null" );
}
break;
}
end:
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:17:38: error: no matching function for call to 'max(int&, std::iterator_traits<int*>::difference_type)'
17 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:17:38: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::iterator_traits<int*>::difference_type' {aka 'long int'})
17 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:17:38: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
17 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:71:9: warning: label at end of compound statement only available with '-std=c++2b' or '-std=gnu++2b' [-Wc++23-extensions]
71 | }
| ^
|
s019830682
|
p00038
|
C++
|
#include<algorithm>
#include<iostream>
#include<stdio.h>
int main()
{
int card[5];
while( scanf( "%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4] ) != EOF ){
int a[20];
std::fill( a, a + 20, 0 );
int c = 0;
for( int i = 0; i < 5; i++ ) a[card[i]]++;
for( int i = 0; i < 5; i++ ){
c = std::max( c, std::count( card, card + 5, card[i] ) );
}
bool f = false;
int m;
switch( c ){
case 4:
puts( "four card" );
break;
case 3:
for( int i = 0; i < 5; i++ ){
if( std::count( card, card + 5, card[i] ) == 2 ){
f = true;
break;
}
}
if( f ){
puts( "full house" );
}
else{
puts( "three card" );
}
break;
case 2:
for( int i = 0; i < 5; i++ ){
if( std::count( card, card + 5, card[i] ) == 2 && !f ){
m = card[i];
f = true;
}
if( card[i] != m && std::count( card, card + 5, card[i] ) == 2 && f ){
puts( "two pair" );
goto end;
}
}
puts( "one pair" );
break;
case 1:
for( int i = 1; i <= 10; i++ ){
if( a[i] == 1 && a[i+1] == 1 && a[i+2] == 1 && a[i+3] == 1 && a[(i+4)%13] == 1 ) f = true;
}
if( f ){
puts( "straight" );
}
else{
puts( "null" );
}
break;
}
end:
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:18:38: error: no matching function for call to 'max(int&, std::iterator_traits<int*>::difference_type)'
18 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:18:38: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::iterator_traits<int*>::difference_type' {aka 'long int'})
18 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:18:38: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
18 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:72:9: warning: label at end of compound statement only available with '-std=c++2b' or '-std=gnu++2b' [-Wc++23-extensions]
72 | }
| ^
|
s455917272
|
p00038
|
C++
|
#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<string.h>
int main()
{
int card[5];
while( scanf( "%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4] ) != EOF ){
int a[20];
memset( a, 0, sizeof( a ) );
int c = 0;
for( int i = 0; i < 5; i++ ) a[card[i]]++;
for( int i = 0; i < 5; i++ ){
c = std::max( c, std::count( card, card + 5, card[i] ) );
}
bool f = false;
int m;
switch( c ){
case 4:
puts( "four card" );
break;
case 3:
for( int i = 0; i < 5; i++ ){
if( std::count( card, card + 5, card[i] ) == 2 ){
f = true;
break;
}
}
if( f ){
puts( "full house" );
}
else{
puts( "three card" );
}
break;
case 2:
for( int i = 0; i < 5; i++ ){
if( std::count( card, card + 5, card[i] ) == 2 && !f ){
m = card[i];
f = true;
}
if( card[i] != m && std::count( card, card + 5, card[i] ) == 2 && f ){
puts( "two pair" );
goto end;
}
}
puts( "one pair" );
break;
case 1:
for( int i = 1; i <= 10; i++ ){
if( a[i] == 1 && a[i+1] == 1 && a[i+2] == 1 && a[i+3] == 1 && a[(i+4)%13] == 1 ) f = true;
}
if( f ){
puts( "straight" );
}
else{
puts( "null" );
}
break;
}
end:
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:19:38: error: no matching function for call to 'max(int&, std::iterator_traits<int*>::difference_type)'
19 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:19:38: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::iterator_traits<int*>::difference_type' {aka 'long int'})
19 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:19:38: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
19 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:73:9: warning: label at end of compound statement only available with '-std=c++2b' or '-std=gnu++2b' [-Wc++23-extensions]
73 | }
| ^
|
s211016303
|
p00038
|
C++
|
#include<algorithm>
#include<iostream>
#include<vector>
#include<stdio.h>
#include<string.h>
int main()
{
int card[5];
while( scanf( "%d,%d,%d,%d,%d", &card[0], &card[1], &card[2], &card[3], &card[4] ) != EOF ){
int a[20];
memset( a, 0, sizeof( a ) );
int c = 0;
for( int i = 0; i < 5; i++ ) a[card[i]]++;
for( int i = 0; i < 5; i++ ){
c = std::max( c, std::count( card, card + 5, card[i] ) );
}
bool f = false;
int m;
switch( c ){
case 4:
puts( "four card" );
break;
case 3:
for( int i = 0; i < 5; i++ ){
if( std::count( card, card + 5, card[i] ) == 2 ){
f = true;
break;
}
}
if( f ){
puts( "full house" );
}
else{
puts( "three card" );
}
break;
case 2:
for( int i = 0; i < 5; i++ ){
if( std::count( card, card + 5, card[i] ) == 2 && !f ){
m = card[i];
f = true;
}
if( card[i] != m && std::count( card, card + 5, card[i] ) == 2 && f ){
puts( "two pair" );
goto end;
}
}
puts( "one pair" );
break;
case 1:
for( int i = 1; i <= 10; i++ ){
if( a[i] == 1 && a[i+1] == 1 && a[i+2] == 1 && a[i+3] == 1 && a[(i+4)%13] == 1 ) f = true;
}
if( f ){
puts( "straight" );
}
else{
puts( "null" );
}
break;
}
end:
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:20:38: error: no matching function for call to 'max(int&, std::iterator_traits<int*>::difference_type)'
20 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:20:38: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::iterator_traits<int*>::difference_type' {aka 'long int'})
20 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:20:38: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
20 | c = std::max( c, std::count( card, card + 5, card[i] ) );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:74:9: warning: label at end of compound statement only available with '-std=c++2b' or '-std=gnu++2b' [-Wc++23-extensions]
74 | }
| ^
|
s354429928
|
p00038
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
int c[6],s[6],ans=0;
string a[7]={"null","one pair","two pair","three card","straight","full
house","four card"};
while(scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2],&c[3],&c[4])!=EOF){
ans=0;
for(int i=0;i<5;i++)s[i]=100;
s[0]=c[0];
for(int i=1;i<5;i++){
for(int j=i-1;j>-1;j--){
if(s[j]<=c[i]){
for(int k=i;k>j+1;k--)s[k]=s[k-1];
s[j+1]=c[i];
break;}}
if(s[0]>c[i]){
for(int k=i;k>0;k--)s[k]=s[k-1];
s[0]=c[i];}}
if(s[0]==s[1]||s[1]==s[2]||s[3]==s[4]||s[2]==s[3])ans=1;
if((s[0]==s[1]||s[1]==s[2])&&(s[2]==s[3]||s[3]==s[4]))ans=2;
if(s[0]==s[2]||s[1]==s[3]||s[2]==s[4])ans=3;
if(s[2]+1==s[3]&&s[1]+1==s[2]&&s[3]+1==s[4]&&(s[0]+1==s[1]||(s[0]==1&&s
[4]==13)))ans=4;
if((s[0]==s[2]&&s[3]==s[4])||(s[0]==s[1]&&s[2]==s[4]))ans=5;
if(s[0]==s[3]||s[1]==s[4])ans=6;
for(int i=0;i<7;i++){if(ans==i)cout<<a[i]<<endl;}
}
}
|
a.cc:7:67: warning: missing terminating " character
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^
a.cc:7:67: error: missing terminating " character
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^~~~~
a.cc:9:18: warning: missing terminating " character
9 | house","four card"};
| ^
a.cc:9:18: error: missing terminating " character
9 | house","four card"};
| ^~~
a.cc: In function 'int main()':
a.cc:9:1: error: 'house' was not declared in this scope
9 | house","four card"};
| ^~~~~
a.cc:9:6: error: expected '}' before user-defined string literal
9 | house","four card"};
| ^~~~~~~
a.cc:7:13: note: to match this '{'
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^
a.cc:9:6: error: expected ',' or ';' before user-defined string literal
9 | house","four card"};
| ^~~~~~~
|
s446786896
|
p00038
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
int c[6],s[6],ans=0;
string a[7]={"null","one pair","two pair","three card","straight","full
house","four card"};
while(scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2],&c[3],&c[4])){
ans=0;
for(int i=0;i<5;i++)s[i]=100;
s[0]=c[0];
for(int i=1;i<5;i++){
for(int j=i-1;j>-1;j--){
if(s[j]<=c[i]){
for(int k=i;k>j+1;k--)s[k]=s[k-1];
s[j+1]=c[i];
break;}}
if(s[0]>c[i]){
for(int k=i;k>0;k--)s[k]=s[k-1];
s[0]=c[i];}}
if(s[0]==s[1]||s[1]==s[2]||s[3]==s[4]||s[2]==s[3])ans=1;
if((s[0]==s[1]||s[1]==s[2])&&(s[2]==s[3]||s[3]==s[4]))ans=2;
if(s[0]==s[2]||s[1]==s[3]||s[2]==s[4])ans=3;
if(s[2]+1==s[3]&&s[1]+1==s[2]&&s[3]+1==s[4]&&(s[0]+1==s[1]||(s[0]==1&&s
[4]==13)))ans=4;
if((s[0]==s[2]&&s[3]==s[4])||(s[0]==s[1]&&s[2]==s[4]))ans=5;
if(s[0]==s[3]||s[1]==s[4])ans=6;
for(int i=0;i<7;i++){if(ans==i)cout<<a[i]<<endl;}
}
}
|
a.cc:7:67: warning: missing terminating " character
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^
a.cc:7:67: error: missing terminating " character
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^~~~~
a.cc:9:18: warning: missing terminating " character
9 | house","four card"};
| ^
a.cc:9:18: error: missing terminating " character
9 | house","four card"};
| ^~~
a.cc: In function 'int main()':
a.cc:9:1: error: 'house' was not declared in this scope
9 | house","four card"};
| ^~~~~
a.cc:9:6: error: expected '}' before user-defined string literal
9 | house","four card"};
| ^~~~~~~
a.cc:7:13: note: to match this '{'
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^
a.cc:9:6: error: expected ',' or ';' before user-defined string literal
9 | house","four card"};
| ^~~~~~~
|
s130008743
|
p00038
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(){
int c[6],s[6],ans=0;
string a[7]={"null","one pair","two pair","three card","straight","full
house","four card"};
while(scanf("%d,%d,%d,%d,%d",&c[0],&c[1],&c[2],&c[3],&c[4])!=EOF){
ans=0;
for(int i=0;i<5;i++)s[i]=100;
s[0]=c[0];
for(int i=1;i<5;i++){
for(int j=i-1;j>-1;j--){
if(s[j]<=c[i]){
for(int k=i;k>j+1;k--)s[k]=s[k-1];
s[j+1]=c[i];
break;}}
if(s[0]>c[i]){
for(int k=i;k>0;k--)s[k]=s[k-1];
s[0]=c[i];}}
if(s[0]==s[1]||s[1]==s[2]||s[3]==s[4]||s[2]==s[3])ans=1;
if((s[0]==s[1]||s[1]==s[2])&&(s[2]==s[3]||s[3]==s[4]))ans=2;
if(s[0]==s[2]||s[1]==s[3]||s[2]==s[4])ans=3;
if(s[2]+1==s[3]&&s[1]+1==s[2]&&s[3]+1==s[4]&&(s[0]+1==s[1]||(s[0]==1&&s
[4]==13)))ans=4;
if((s[0]==s[2]&&s[3]==s[4])||(s[0]==s[1]&&s[2]==s[4]))ans=5;
if(s[0]==s[3]||s[1]==s[4])ans=6;
for(int i=0;i<7;i++){if(ans==i)cout<<a[i]<<endl;}
}
}
|
a.cc:7:67: warning: missing terminating " character
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^
a.cc:7:67: error: missing terminating " character
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^~~~~
a.cc:9:18: warning: missing terminating " character
9 | house","four card"};
| ^
a.cc:9:18: error: missing terminating " character
9 | house","four card"};
| ^~~
a.cc: In function 'int main()':
a.cc:9:1: error: 'house' was not declared in this scope
9 | house","four card"};
| ^~~~~
a.cc:9:6: error: expected '}' before user-defined string literal
9 | house","four card"};
| ^~~~~~~
a.cc:7:13: note: to match this '{'
7 | string a[7]={"null","one pair","two pair","three card","straight","full
| ^
a.cc:9:6: error: expected ',' or ';' before user-defined string literal
9 | house","four card"};
| ^~~~~~~
|
s863294165
|
p00038
|
C++
|
<?php
while (TRUE) {
$c = fscanf(STDIN, '%d,%d,%d,%d,%d');
if (feof(STDIN)) {
break;
}
sort($c);
$hash = array();
$max = 0;
foreach ($c as $v) {
if (!isset($hash[$v])) {
$hash[$v] = 0;
}
$hash[$v]++;
$max = $hash[$v] > $max ? $hash[$v] : $max;
}
arsort($hash);
$combo = 'null';
if ($max >= 2) {
$combo = 'one pair';
}
if ($max >= 2 && count($hash) <= 3) {
$combo = 'two pair';
}
if ($max >= 3) {
$combo = 'three card';
}
if (count($hash) === 5 && isStraight($c)) {
$combo = 'straight';
}
if ($max >= 3 && count($hash) <= 2) {
$combo = 'full house';
}
if ($max >= 4) {
$combo = 'four card';
}
echo $combo . PHP_EOL;
}
function isStraight($cards) {
if (max($cards) - min($cards) === 4) {
return true;
}
if ($cards[0] === 1 && $cards[1] === 10 && $cards[4] === 13) {
return true;
}
return false;
}
|
a.cc:4:24: warning: multi-character literal with 14 characters exceeds 'int' size of 4 bytes
4 | $c = fscanf(STDIN, '%d,%d,%d,%d,%d');
| ^~~~~~~~~~~~~~~~
a.cc:19:14: warning: multi-character character constant [-Wmultichar]
19 | $combo = 'null';
| ^~~~~~
a.cc:21:18: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
21 | $combo = 'one pair';
| ^~~~~~~~~~
a.cc:24:18: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
24 | $combo = 'two pair';
| ^~~~~~~~~~
a.cc:27:18: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
27 | $combo = 'three card';
| ^~~~~~~~~~~~
a.cc:30:18: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
30 | $combo = 'straight';
| ^~~~~~~~~~
a.cc:33:18: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
33 | $combo = 'full house';
| ^~~~~~~~~~~~
a.cc:36:18: warning: multi-character literal with 9 characters exceeds 'int' size of 4 bytes
36 | $combo = 'four card';
| ^~~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before '<' token
1 | <?php
| ^
a.cc:41:1: error: 'function' does not name a type; did you mean 'union'?
41 | function isStraight($cards) {
| ^~~~~~~~
| union
|
s419304486
|
p00038
|
C++
|
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
int i,j,k,l;
int card[5];
int poker_hand;
bool flag;
while(true){
poker_hand=0;
for(i=0;i<5;i++){
if(scanf("%d,",&card[i])==EOF)return(0);
}
sort(card,card+5);
for(i=0;i<4;i++){
if(card[i]==card[i+1])poker_hand=1;
}
if(card[0]==card[1]&&card[2]==card[3])poker_hand=2;
if(card[0]==card[1]&&card[3]==card[4])poker_hand=2;
if(card[1]==card[2]&&card[3]==card[4])poker_hand=2;
for(i=0;i<3;i++){
if(card[i]==card[i+1]&&card[i]==card[i+2])poker_hand=3;
}
flag=true;
for(i=1;i<5;i++){
if(card[i]!=card[0]+i)flag=false;
}
if(flag)poker_hand=4;
flag=true;
if(card[0]==1&&card[1]==10){
for(i=1;i<4;i++){
if(card[i+1]!=card[1]+i)flag=false;
}
}else{
flag=false;
}
if(flag)poker_hand=4;
if(card[0]==card[1]&&card[0]==card[2]&&card[3]==card[4])poker_hand=5;
if(card[0]==card[1]&&card[2]==card[3]&&card[2]==card[4])poker_hand=5;
if(card[0]==card[3])poker_hand=6;
if(card[1]==card[4])poker_hand=6;
switch (poker_hand) {
case 0:
printf("null\n");
break;
case 1:
printf("one pair\n");
break;
case 2:
printf("two pair\n");
break;
case 3:
printf("three card\n");
break;
case 4:
printf("straight\n");
break;
case 5:
printf("full house\n");
break;
case 6:
printf("four card\n");
break;
}
}
return(0);
}
|
a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
17 | sort(card,card+5);
| ^~~~
| short
|
s359193144
|
p00038
|
C++
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AOJ
{
class Program
{
static void Main(string[] args)
{
string s;
while ((s = Console.ReadLine()) != null)
{
var list = s.Split(',').Select(int.Parse).ToList();
list.Sort();
var dict = new Dictionary<int, int>();
foreach (var v in list)
{
if (dict.ContainsKey(v))
{
var i = dict[v] + 1;
dict.Remove(v); dict.Add(v, i);
}
else
{
dict.Add(v, 1);
}
}
bool isStraight = true;
for (int i = list[0]; i < list[0] + 5; i++)
{
if (list[i - list[0]] != i) { isStraight = false; break; }
}
if (list[0] == 1)
{
isStraight = true;
for (int i = 0; i < 4; i++)
{
if (list[i+1] != 10+i) { isStraight = false; break; }
}
}
bool isFour = false;
bool isThree = false;
int Pairs = 0;
var lk = dict.Keys;
foreach (var v in lk)
{
isFour |= dict[v] == 4;
isThree |= dict[v] == 3;
Pairs += dict[v] == 2 ? 1 : 0;
}
string result = "null";
if (isFour) result = "four card";
else if (isThree && Pairs > 0) result = "full house";
else if (isStraight) result = "straight";
else if (isThree) result = "three card";
else if (Pairs == 2) result = "two pairs";
else if (Pairs > 0) result = "one pair";
Console.WriteLine(result);
}
}
}
}
|
a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:10:26: error: 'string' has not been declared
10 | static void Main(string[] args)
| ^~~~~~
a.cc:10:35: error: expected ',' or '...' before 'args'
10 | static void Main(string[] args)
| ^~~~
a.cc:68:6: error: expected ';' after class definition
68 | }
| ^
| ;
a.cc: In static member function 'static void AOJ::Program::Main(int*)':
a.cc:12:13: error: 'string' was not declared in this scope
12 | string s;
| ^~~~~~
a.cc:13:21: error: 's' was not declared in this scope
13 | while ((s = Console.ReadLine()) != null)
| ^
a.cc:13:25: error: 'Console' was not declared in this scope
13 | while ((s = Console.ReadLine()) != null)
| ^~~~~~~
a.cc:13:48: error: 'null' was not declared in this scope
13 | while ((s = Console.ReadLine()) != null)
| ^~~~
a.cc:15:17: error: 'var' was not declared in this scope
15 | var list = s.Split(',').Select(int.Parse).ToList();
| ^~~
a.cc:16:17: error: 'list' was not declared in this scope
16 | list.Sort();
| ^~~~
a.cc:17:21: error: expected ';' before 'dict'
17 | var dict = new Dictionary<int, int>();
| ^~~~
a.cc:18:30: error: expected ')' before 'v'
18 | foreach (var v in list)
| ^
a.cc:18:25: note: to match this '('
18 | foreach (var v in list)
| ^
a.cc:18:17: error: 'foreach' was not declared in this scope
18 | foreach (var v in list)
| ^~~~~~~
a.cc:48:21: error: expected ';' before 'lk'
48 | var lk = dict.Keys;
| ^~
a.cc:49:30: error: expected ')' before 'v'
49 | foreach (var v in lk)
| ^
a.cc:49:25: note: to match this '('
49 | foreach (var v in lk)
| ^
a.cc:56:24: error: expected ';' before 'result'
56 | string result = "null";
| ^~~~~~
a.cc:58:29: error: 'result' was not declared in this scope
58 | if (isFour) result = "four card";
| ^~~~~~
a.cc:59:48: error: 'result' was not declared in this scope
59 | else if (isThree && Pairs > 0) result = "full house";
| ^~~~~~
a.cc:60:38: error: 'result' was not declared in this scope
60 | else if (isStraight) result = "straight";
| ^~~~~~
a.cc:61:35: error: 'result' was not declared in this scope
61 | else if (isThree) result = "three card";
| ^~~~~~
a.cc:62:38: error: 'result' was not declared in this scope
62 | else if (Pairs == 2) result = "two pairs";
| ^~~~~~
a.cc:63:37: error: 'result' was not declared in this scope
63 | else if (Pairs > 0) result = "one pair";
| ^~~~~~
a.cc:65:35: error: 'result' was not declared in this scope
65 | Console.WriteLine(result);
| ^~~~~~
|
s284397820
|
p00038
|
C++
|
#include <stdio.h>
#include <iostream>
using namespace std;
int main() {
int a[5];
int kari;
char d;
while (cin >> a[0] >> d >> a[1] >> d >> a[2] >> d >> a[3] >> d >> a[4]) {
for (int i = 4; i > 0; i--) {
for (int j = 0; j < i; j++) {
if (a[j] > a[j+1]) {
kari = a[j];
a[j] = a[j+1];
a[j+1] = kari;
}
}
}
if (a[0] == a[1] || a[1] == a[2] || a[2] == a[3] || a[3] == a[4]) {
if ((a[0] == a[1] && a[1] == a[2]) || (a[1] == a[2] && a[2] == a[3]) || (a[2] == a[3] && a[3] == a[4])) {
if (((a[0] == a[1] && a[1] == a[2]) && (a[3] == a[4])) || ((a[0] == a[1]) && (a[2] == a[3] && a[3] == a[4]))) {
cout << "full house" << endl;
} else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
cout << "four card" << endl;
}else {
cout << "three card" << endl;
}
} else if ((a[0] == a[1] && a[2] == a[3]) || (a[0] == a[1] && a[3] == a[4]) || (a[1] == a[2] && a[3] == a[4])) {
if ((a[0] == a[1] && a[1] == a[2] && a[2] == a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])) {
cout << "four card" << endl;
} else {
cout << "two pair" << endl;
}
} else {
cout << "one pair" << endl;
}
} else if ((a[1] == a[0] + 1 && a[2] == a[1] + 1 && a[3] == a[2] + 1 && a[4] == a[3] + 1) || (a[0] == 1 && a[1] == 10 && a[2] == a[1] + 1 && a[3] == a[2] + 1 && a[4] == a[3] + 1)){
cout << "straight" << endl;
} else {
cout << "null" << endl;
}
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:26:62: error: expected identifier before numeric constant
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
a.cc: In lambda function:
a.cc:26:64: error: expected '{' before '==' token
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^~
a.cc: In function 'int main()':
a.cc:26:64: error: no match for 'operator==' (operand types are 'main()::<lambda()>' and 'int')
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ~~~^~~~~~
| | |
| | int
| main()::<lambda()>
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::fpos<_StateT>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
In file included from /usr/include/c++/14/string:43,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::allocator<_CharT>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::reverse_iterator<_Iterator>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::reverse_iterator<_Iterator>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::move_iterator<_IteratorL>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::move_iterator<_IteratorL>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::pair<_T1, _T2>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] == a[2] && a[2] == a[3] && a[3] == a[4])){
| ^
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:26:69: note: 'main()::<lambda()>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
26 | } else if ((a[0] == a[1] && a[1] == a[2] && [2]==a[3]) || (a[1] =
|
s668018811
|
p00038
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int Result(int cards[5]){
int num_card[13];
bool four=false, three=false, two=false;
int num_two=0;
int min = 12,max = 0;
for(int i=0;i<13;++i)num_card[i]=0;
for(int i=0;i<5;++i){
num_card[ cards[i] - 1 ] ++;
}
for(int i=0;i<13;++i){
if(num_card[i]>0){
if(i<min)min=i;
if(i>max)max=i;
if(num_card[i]==4)four=true;
else if(num_card[i]==3)three=true;
else if(num_card[i]==2){
two=true;
++num_two;
}
}
}
if(four)return 7;
else if(three){
if(two)return 6;
else return 4;
}
else if(two){
if(num_two == 2)return 3;
else return 2;
}
if(max-min+1 == 5)
return 5;
return 1;
}
void toint(string s, int cards[5]){
int m=0;
for(int i=0;i<5;++i){
int n=0;
if(s[m]==',' || s[m]=='\0'){
cards[i] = n;
++m;
continue;
}
n += n*10 + s[m]-'0';
++m;
--n;
}
}
int main(){
string s, res;
int card[5] = {1,2,3,4,5};
cin >> s;
toint(s,card);
switch Result(card){
case 1:res="null";break;
case 2:res="one pair";break;
case 3:res="two pair";break;
case 4:res="three card";break;
case 5:res="straight";break;
case 6:res="full house";break;
case 7:res="four card";break;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:80:16: error: expected '(' before 'Result'
80 | switch Result(card){
| ^~~~~~
| (
|
s461729123
|
p00038
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int Result(int cards[5]){
int num_card[13];
bool four=false, three=false, two=false;
int num_two=0;
int min = 12,max = 0;
for(int i=0;i<13;++i)num_card[i]=0;
for(int i=0;i<5;++i){
num_card[ cards[i] - 1 ] ++;
}
for(int i=0;i<13;++i){
if(num_card[i]>0){
if(i<min)min=i;
if(i>max)max=i;
if(num_card[i]==4)four=true;
else if(num_card[i]==3)three=true;
else if(num_card[i]==2){
two=true;
++num_two;
}
}
}
if(four)return 7;
else if(three){
if(two)return 6;
else return 4;
}
else if(two){
if(num_two == 2)return 3;
else return 2;
}
if(max-min+1 == 5)
return 5;
return 1;
}
int strtoint(char *s){
int n=0;
while(*s!='\0'){
n += n*10 + *s - '0';
s++;
}
return n;
}
void toint(char *s, int cards[5]){
char *tp;
tp = strtok(s,",");
cards[0] = strtoint(tp);
for(int i=1;i<5;++i){
tp = strtok(NULL,",");
cards[i] = strtoint(tp);
}
}
int main(){
char s[32];
string res;
int card[5];
cin >> s;
toint(s,card);
switch( Result(card) ){
case 1:res="null";break;
case 2:res="one pair";break;
case 3:res="two pair";break;
case 4:res="three card";break;
case 5:res="straight";break;
case 6:res="full house";break;
case 7:res="four card";break;
}
cout << res;
return 0;
}
|
a.cc: In function 'void toint(char*, int*)':
a.cc:62:14: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
62 | tp = strtok(s,",");
| ^~~~~~
| strtoq
|
s653491965
|
p00039
|
Java
|
import java.util.Hashtable;
import java.util.Scanner;
public class AOJ_Volume0039 {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
Hashtable<Character,Integer> roman = new Hashtable<Character,Integer>();
roman.put('I',1);
roman.put('V',5);
roman.put('X',10);
roman.put('L',50);
roman.put('C',100);
roman.put('D',500);
roman.put('M',1000);
while(sc.hasNext()){
char[] s = sc.nextLine().toCharArray();
int ans = 0;
for(int i=0;i<s.length-1;i++){
if(roman.get(s[i]) >= roman.get(s[i+1])) ans += roman.get(s[i]);
else ans -= roman.get(s[i]);
}
ans += roman.get(s[s.length - 1]);
System.out.println(ans);
}
}
}
|
Main.java:5: error: class AOJ_Volume0039 is public, should be declared in a file named AOJ_Volume0039.java
public class AOJ_Volume0039 {
^
1 error
|
s883614204
|
p00039
|
Java
|
import java.io.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=br.readLine())!=null){
int ans=0:
char[] n=line.toCharArray();
int[] fig=new int[n.length];
for(int i=0;i<fig.length;i++){
fig[i]=toNum(n[i]);
}
for(int i=1;i<fig.length;i++){
if(fig[i-1]<fig[i]){
fig[i-1]*=-1;
}
}
for(int i=0;i<fig.length;i++){
ans+=fig[i];
}
}
static int toNum(char c){
switch(c){
case I: return 1;
case V: return 5;
case X: return 10;
case L: return 50;
case C: return 100;
case D: return 500;
case M: return 1000;
}
}
}
|
Main.java:8: error: ';' expected
int ans=0:
^
Main.java:23: error: illegal start of expression
static int toNum(char c){
^
2 errors
|
s132649817
|
p00039
|
Java
|
import java.io.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=br.readLine())!=null){
int ans=0;
char[] n=line.toCharArray();
int[] fig=new int[n.length];
for(int i=0;i<fig.length;i++){
fig[i]=toNum(n[i]);
}
for(int i=1;i<fig.length;i++){
if(fig[i-1]<fig[i]){
fig[i-1]*=-1;
}
}
for(int i=0;i<fig.length;i++){
ans+=fig[i];
}
}
}
static int toNum(char c){
switch(c){
case I: return 1;
case V: return 5;
case X: return 10;
case L: return 50;
case C: return 100;
case D: return 500;
case M: return 1000;
}
}
|
Main.java:34: error: reached end of file while parsing
}
^
1 error
|
s026149294
|
p00039
|
Java
|
import java.io.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=br.readLine())!=null){
int ans=0;
char[] n=line.toCharArray();
int[] fig=new int[n.length];
for(int i=0;i<fig.length;i++){
fig[i]=toNum(n[i]);
}
for(int i=1;i<fig.length;i++){
if(fig[i-1]<fig[i]){
fig[i-1]*=-1;
}
}
for(int i=0;i<fig.length;i++){
ans+=fig[i];
}
}
}
static int toNum(char c){
switch(c){
case I: return 1;
case V: return 5;
case X: return 10;
case L: return 50;
case C: return 100;
case D: return 500;
case M: return 1000;
}
}
}
|
Main.java:26: error: cannot find symbol
case I: return 1;
^
symbol: variable I
location: class Main
Main.java:27: error: cannot find symbol
case V: return 5;
^
symbol: variable V
location: class Main
Main.java:28: error: cannot find symbol
case X: return 10;
^
symbol: variable X
location: class Main
Main.java:29: error: cannot find symbol
case L: return 50;
^
symbol: variable L
location: class Main
Main.java:30: error: cannot find symbol
case C: return 100;
^
symbol: variable C
location: class Main
Main.java:31: error: cannot find symbol
case D: return 500;
^
symbol: variable D
location: class Main
Main.java:32: error: cannot find symbol
case M: return 1000;
^
symbol: variable M
location: class Main
7 errors
|
s952539670
|
p00039
|
Java
|
import java.io.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=br.readLine())!=null){
int ans=0;
char[] n=line.toCharArray();
int[] fig=new int[n.length];
for(int i=0;i<fig.length;i++){
fig[i]=toNum(n[i]);
}
for(int i=1;i<fig.length;i++){
if(fig[i-1]<fig[i]){
fig[i-1]*=-1;
}
}
for(int i=0;i<fig.length;i++){
ans+=fig[i];
}
}
}
static int toNum(char c){
switch(c){
case 'I': return 1;
case 'V': return 5;
case 'X': return 10;
case 'L': return 50;
case 'C': return 100;
case 'D': return 500;
case 'M': return 1000;
}
}
}
|
Main.java:34: error: missing return statement
}
^
1 error
|
s970329378
|
p00039
|
Java
|
import java.io.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=br.readLine())!=null){
int ans=0;
char[] n=line.toCharArray();
int[] fig=new int[n.length];
for(int i=0;i<fig.length;i++){
fig[i]=toNum(n[i]);
}
for(int i=1;i<fig.length;i++){
if(fig[i-1]<fig[i]){
fig[i-1]*=-1;
}
}
for(int i=0;i<fig.length;i++){
ans+=fig[i];
}
}
}
static int toNum(char c){
switch(c){
case 'I': return 1;
case 'V': return 5;
case 'X': return 10;
case 'L': return 50;
case 'C': return 100;
case 'D': return 500;
case 'M': return 1000;
}
}
}
|
Main.java:34: error: missing return statement
}
^
1 error
|
s200314705
|
p00039
|
Java
|
import java.io.*;
class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
while((line=br.readLine())!=null){
int ans=0;
char[] n=line.toCharArray();
int[] fig=new int[n.length];
for(int i=0;i<fig.length;i++){
fig[i]=toNum(n[i]);
}
for(int i=1;i<fig.length;i++){
if(fig[i-1]<fig[i]){
fig[i-1]*=-1;
}
}
for(int i=0;i<fig.length;i++){
ans+=fig[i];
}
}
}
static int toNum(char c){
int n;
switch(c){
case 'I': n=1;
break;
case 'V': n=5;
break;
case 'X': n=10;
break;
case 'L': n=50;
break;
case 'C': n=100;
break;
case 'D': n=500;
break;
case 'M': n=1000;
break;
}
return n;
}
}
|
Main.java:42: error: variable n might not have been initialized
return n;
^
1 error
|
s909218166
|
p00039
|
Java
|
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main{
public static void main(String args[]){
BufferedReader reader =
new BufferedReader(new InputStreamReader(System.in));
String st = "";
int[] a = new int[100];
int sum;
while (true){
try{
st = reader.readLine();
}catch(IOException e){
}
sum = 0;
for (int i = 0; i < st.length(); i++) {
if (st.charAt(i) == 'I') a[i] = 1;
if (st.charAt(i) == 'V') a[i] = 5;
if (st.charAt(i) == 'X') a[i] = 10;
if (st.charAt(i) == 'L') a[i] = 50;
if (st.charAt(i) == 'C') a[i] = 100;
if (st.charAt(i) == 'D') a[i] = 500;
if (st.charAt(i) == 'M') a[i] = 1000;
if (i != 0 && a[i - 1] < a[i]) {
a[i] -= a[i - 1];
a[i - 1] = 0;
}
}
for (int i = 0; i < st.length(); i++) {
sum += a[i];
}
System.out.println(sum);
}
try{
reader.close();
}catch(IOException e){
}
}
}
|
Main.java:41: error: unreachable statement
try{
^
1 error
|
s629510981
|
p00039
|
Java
|
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import javafx.scene.shape.Ellipse;
class Main {
static String line;
static String[] sx = { "XC", "XL", "XXX", "XX", "XIX", "XIV", "XIII", "XII", "XI", "XVIII", "XVII", "XVI", "XV",
"X" };
static int[] ix = { 90, 40, 30, 20, 19, 14, 13, 12, 11, 18, 17, 16, 15, 10 };
static String[] sl = { "LXXX", "LXX", "LX", "L" };
static int[] il = { 80, 70, 60, 50 };
static String[] sv = { "VIII", "VII", "VI", "V" };
static int[] iv = { 8, 7, 6, 5 };
static String[] si = { "IX", "IV", "III", "II", "I" };
static int[] ii = { 9, 4, 3, 2, 1 };
static String[] so = { "M", "D", "C" };
static int[] io = { 1000, 500, 100 };
static String[] sss;
static int[] iii;
static int getValue() {
setarr();
for (int i = 0; i < sss.length; i++) {
if (line.startsWith(sss[i])){
line = line.replaceFirst(sss[i], "");
return iii[i];
}
}
return 0; // unreachable
}
static void setarr() {
switch (line.charAt(0)) {
case 'X':
sss = sx;
iii = ix;
break;
case 'L':
sss = sl;
iii = il;
break;
case 'V':
sss = sv;
iii = iv;
break;
case 'I':
sss = si;
iii = ii;
break;
default:
sss = so;
iii = io;
}
}
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while ((line = br.readLine()) != null) {
int score = getValue();
while (line.length() != 0) {
int next = getValue();
if (score >= next)
score += next;
else
score = next-score;
}
System.out.println(score);
}
}
}
|
Main.java:5: error: package javafx.scene.shape does not exist
import javafx.scene.shape.Ellipse;
^
1 error
|
s274050341
|
p00039
|
Java
|
import java.util.Scanner;
public class AOJ0039 {
int n;
public static void main(String[] args) {
//new AOJ0039().run();
new Main().run();
}
void run(){
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
String str=sc.next();
n=str.length();
System.out.println(roman(str.toCharArray(),0,0,0));
}
}
//IVXLCDM
int roman(char ch[],int i,int k,int sum){
//System.out.println(i+" "+sum);
if(i==n){
return sum;
}
if(ch[i]=='I'){
return roman(ch,i+1,1,sum+1);
}else if(ch[i]=='V'){
if(k<5){
return roman(ch,i+1,5,sum+(5-k)-k);
}
return roman(ch,i+1,5,sum+5);
}else if(ch[i]=='X'){
if(k<10){
return roman(ch,i+1,10,sum+(10-k)-k);
}
return roman(ch,i+1,10,sum+10);
}else if(ch[i]=='L'){
if(k<50){
return roman(ch,i+1,50,sum+(50-k)-k);
}
return roman(ch,i+1,50,sum+50);
}else if(ch[i]=='C'){
if(k<100){
return roman(ch,i+1,100,sum+(100-k)-k);
}
return roman(ch,i+1,100,sum+100);
}else if(ch[i]=='D'){
if(k<500){
return roman(ch,i+1,500,sum+(500-k)-k);
}
return roman(ch,i+1,500,sum+500);
}else if(ch[i]=='M'){
if(k<1000){
return roman(ch,i+1,1000,sum+(1000-k)-k);
}
return roman(ch,i+1,1000,sum+1000);
}
return -1;
}
}
|
Main.java:3: error: class AOJ0039 is public, should be declared in a file named AOJ0039.java
public class AOJ0039 {
^
Main.java:7: error: cannot access Main
new Main().run();
^
bad source file: ./Main.java
file does not contain class Main
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
2 errors
|
s844100206
|
p00039
|
Java
|
import java.io.*;
class Main
{
public static void main(String args[])throws IOException
{
BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
String str;
int a[]=new int[str.length()];
while((str=input.readLine())!=null)
{
String str_ary[]=new String[str.length()];
for(int i=0;i<str.length();i++)
{
str_ary[i]=""+str.charAt(i);
if(str_ary[i].equals("I"))a[i]=1;
if(str_ary[i].equals("V"))a[i]=5;
if(str_ary[i].equals("X"))a[i]=10;
if(str_ary[i].equals("L"))a[i]=50;
if(str_ary[i].equals("C"))a[i]=100;
if(str_ary[i].equals("D"))a[i]=500;
if(str_ary[i].equals("M"))a[i]=1000;
}
int sum=0;
for(int i=0;i<a.length-1;i+=2)
{
if(a[i]>=a[i+1])sum+=a[i]+a[i+1];
if(a[i]<a[i+1])sum+=a[i+1]-a[i];
}
if(a.length%2!=0 && a[a.length-1]>a[a.length-2])sum+=a[a.length-1]-a[a.length-2];
if(a.length%2!=0 && a[a.length-1]<a[a.length-2])sum+=a[a.length-1]+a[a.length-2];
System.out.println(sum);
}
}
}
|
Main.java:8: error: variable str might not have been initialized
int a[]=new int[str.length()];
^
1 error
|
s101670070
|
p00039
|
C
|
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main(){
string s;
map<char,int>mp={
{'I',1},
{'V',5},
{'X',10},
{'L',50},
{'C',100},
{'D',500},
{'M',1000}
};
while(cin>>s){
int cnt=mp[s[0]],r=1;
char back=s[0];
if(i>1){
for(int i=1;i<s.size();i++){
if(back==s[i])r++;
}
}
cout<<cnt<<endl;
}
return 0;
}
|
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
1 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s853314161
|
p00039
|
C
|
V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
|
main.c:1:1: warning: data definition has no type or storage class
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'V' [-Wimplicit-int]
main.c:1:46: warning: data definition has no type or storage class
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^
main.c:1:46: error: type defaults to 'int' in declaration of 'v' [-Wimplicit-int]
main.c:1:48: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^
main.c:1:50: error: type defaults to 'int' in declaration of 's' [-Wimplicit-int]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^
main.c:1:56: error: type defaults to 'int' in declaration of 'r' [-Wimplicit-int]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^
main.c:1:58: error: return type defaults to 'int' [-Wimplicit-int]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^~~~
main.c: In function 'main':
main.c:1:58: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:71: error: assignment to 'int' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^
main.c:1:76: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^~~~~~~
main.c:1:1: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
+++ |+#include <stdio.h>
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
main.c:1:104: error: implicit declaration of function 'strchr' [-Wimplicit-function-declaration]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strchr'
+++ |+#include <string.h>
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
main.c:1:104: warning: incompatible implicit declaration of built-in function 'strchr' [-Wbuiltin-declaration-mismatch]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^~~~~~
main.c:1:104: note: include '<string.h>' or provide a declaration of 'strchr'
main.c:1:103: error: array subscript is not an integer
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^
main.c:1:135: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | V[]={1e3,500,100,50,10,5,1};char*R="NEDMYWJ";v,n,s=1e3,r;main(c){for(r=R;c=getchar()+1;s=v)n=c-11?(v=V[strchr(R,c)-r],n+v-s*2*(s<v)):!printf("%d\n",n,v=*V);}
| ^~~~~~
main.c:1:135: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:135: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:135: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s668024161
|
p00039
|
C
|
n,l,t[256];
main(char r[]){
t[73]=1;
t[86]=5;
t[88]=10;
t[76]=50;
t[67]=100;
t[68]=500;
t[77]=1000;
for(;l=read(0,r,128);){
n=t[r[l--]];
for (;l--;){
n+=t[r[l]*(t[r[l+1]]>t[r[i]]?-1:1);
}
printf("%d\n",n);
}
return (0);
}
|
main.c:1:1: warning: data definition has no type or storage class
1 | n,l,t[256];
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
1 | n,l,t[256];
| ^
main.c:1:5: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
1 | n,l,t[256];
| ^
main.c:2:1: error: return type defaults to 'int' [-Wimplicit-int]
2 | main(char r[]){
| ^~~~
main.c: In function 'main':
main.c:11:12: error: implicit declaration of function 'read' [-Wimplicit-function-declaration]
11 | for(;l=read(0,r,128);){
| ^~~~
main.c:14:38: error: 'i' undeclared (first use in this function)
14 | n+=t[r[l]*(t[r[l+1]]>t[r[i]]?-1:1);
| ^
main.c:14:38: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:47: error: expected ']' before ';' token
14 | n+=t[r[l]*(t[r[l+1]]>t[r[i]]?-1:1);
| ^
| ]
main.c:14:48: error: expected ';' before '}' token
14 | n+=t[r[l]*(t[r[l+1]]>t[r[i]]?-1:1);
| ^
| ;
15 | }
| ~
main.c:16:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
16 | printf("%d\n",n);
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | n,l,t[256];
main.c:16:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
16 | printf("%d\n",n);
| ^~~~~~
main.c:16:9: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s364665007
|
p00039
|
C
|
main()
{
int t[256],n,l;
char r[128];
t[73] = 1;
t[86] = 5;
t[88] = 10;
t[76] = 50;
t[67] = 100;
t[68] = 500;
t[77] = 1000;
for(;l=read(0,r,128);){
n=t[r[--l]];
for(;--l;){
n+=t[r[l]]*(t[r[l+1]]>t[r[i]]?-1:1);
}
printf("%d\n", n);
}
return (0);
}
|
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main()
| ^~~~
main.c: In function 'main':
main.c:14:12: error: implicit declaration of function 'read' [-Wimplicit-function-declaration]
14 | for(;l=read(0,r,128);){
| ^~~~
main.c:17:39: error: 'i' undeclared (first use in this function)
17 | n+=t[r[l]]*(t[r[l+1]]>t[r[i]]?-1:1);
| ^
main.c:17:39: note: each undeclared identifier is reported only once for each function it appears in
main.c:19:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
19 | printf("%d\n", n);
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | main()
main.c:19:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
19 | printf("%d\n", n);
| ^~~~~~
main.c:19:9: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s605845893
|
p00039
|
C
|
#include<stdio.h>
int main(){
int i,j,moji[100]sum;
char tmp[100];
while(fgets(tmp,100,stdin)!=NULL){
sum=0;
i=0;
while(tmp[i]!='\0'){
if(tmp[i]=='I') moji[i]=1;
else if(tmp[i]=='V') moji[i]=5;
else if(tmp[i]=='X') moji[i]=10;
else if(tmp[i]=='L') moji[i]=50;
else if(tmp[i]=='C') moji[i]=100;
else if(tmp[i]=='D') moji[i]=500;
else if(tmp[i]=='M') moji[i]=1000;
i++;
}
i--;
for(j=i;j!=0;j--){
if(moji[j]>moji[j-1]){
sum+=moji[j]-moji[j-1];
}
else if(moji[j]<moji[j-1]){
sum+=moji[j]+moji[j-1];
}
}
printf("%d\n",sum);
}
return 0;
}
|
main.c: In function 'main':
main.c:5:26: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'sum'
5 | int i,j,moji[100]sum;
| ^~~
main.c:9:17: error: 'sum' undeclared (first use in this function)
9 | sum=0;
| ^~~
main.c:9:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:41: error: 'moji' undeclared (first use in this function)
12 | if(tmp[i]=='I') moji[i]=1;
| ^~~~
|
s070953566
|
p00039
|
C
|
#include<stdio.h>
int main(){
int i,j,moji[100],sum;
char tmp[100];
while(fgets(tmp,100,stdin)!=NULL){
sum=0;
i=0;
while(tmp[i]!=10){
if(tmp[i]=='I') moji[i]=1;
else if(tmp[i]=='V') moji[i]=5;
else if(tmp[i]=='X') moji[i]=10;
else if(tmp[i]=='L') moji[i]=50;
else if(tmp[i]=='C') moji[i]=100;
else if(tmp[i]=='D') moji[i]=500;
else if(tmp[i]=='M') moji[i]=1000;
i++;
}
i--;
for(j=i;j!=0;j--){
if(moji[j]>moji[j-1]){
sum+=moji[j]-moji[j-1];
}
else if(moji[j]=<moji[j-1]){
sum+=moji[j]+moji[j-1];
}
}
printf("%d\n",sum);
}
return 0;
}
|
main.c: In function 'main':
main.c:26:41: error: expected expression before '<' token
26 | else if(moji[j]=<moji[j-1]){
| ^
|
s082355686
|
p00039
|
C++
|
#include <cstdio>
#include <map>
using namespace std;
int main()
{
map <string, int> list;
list["I"] = 1;
list["V"] = 5;
list["X"] = 10;
list["L"] = 50;
list["C"] = 100;
list["D"] = 500;
list["M"] = 1000;
list["N"] = 0;
char s[10001];
while(scanf("%s", s) != EOF){
string str = s;
string str_next = s;
int len = str.size();
int sum = 0;
for(int i = 0; i < len; i++){
str = s[i];
str_next = s[i+1];
if(list[str] < list[str_next]){
sum += list[str_next] - list[str];
i++;
}
else sum += list[str];
}
printf("%d\n", sum);
}
}
|
a.cc: In function 'int main()':
a.cc:8:14: error: 'string' was not declared in this scope
8 | map <string, int> list;
| ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
2 | #include <map>
+++ |+#include <string>
3 |
a.cc:8:25: error: template argument 1 is invalid
8 | map <string, int> list;
| ^
a.cc:8:25: error: template argument 3 is invalid
a.cc:8:25: error: template argument 4 is invalid
a.cc:10:19: error: assignment of read-only location '"I"[list]'
10 | list["I"] = 1;
| ~~~~~~~~~~^~~
a.cc:11:19: error: assignment of read-only location '"V"[list]'
11 | list["V"] = 5;
| ~~~~~~~~~~^~~
a.cc:12:19: error: assignment of read-only location '"X"[list]'
12 | list["X"] = 10;
| ~~~~~~~~~~^~~~
a.cc:13:19: error: assignment of read-only location '"L"[list]'
13 | list["L"] = 50;
| ~~~~~~~~~~^~~~
a.cc:14:19: error: assignment of read-only location '"C"[list]'
14 | list["C"] = 100;
| ~~~~~~~~~~^~~~~
a.cc:15:19: error: assignment of read-only location '"D"[list]'
15 | list["D"] = 500;
| ~~~~~~~~~~^~~~~
a.cc:16:19: error: assignment of read-only location '"M"[list]'
16 | list["M"] = 1000;
| ~~~~~~~~~~^~~~~~
a.cc:17:19: error: assignment of read-only location '"N"[list]'
17 | list["N"] = 0;
| ~~~~~~~~~~^~~
a.cc:21:23: error: expected ';' before 'str'
21 | string str = s;
| ^~~~
| ;
a.cc:22:23: error: expected ';' before 'str_next'
22 | string str_next = s;
| ^~~~~~~~~
| ;
a.cc:24:27: error: 'str' was not declared in this scope; did you mean 'std'?
24 | int len = str.size();
| ^~~
| std
a.cc:30:25: error: 'str_next' was not declared in this scope
30 | str_next = s[i+1];
| ^~~~~~~~
|
s774708315
|
p00039
|
C++
|
#include <stdio.h>
char c[200];
int main(){
int ans;
int n;
while(scanf("%s",&c) != EOF){
n = strlen(c);
ans = 0;
for(int i = 0; i < n; i++){
if(c[i] == 'I'){
if(c[i + 1] == 'V' || c[i + 1] == 'X'){
ans -= 1;
}else{
ans += 1;
}
}
if(c[i] == 'X'){
if(c[i + 1] == 'L' || c[i + 1] == 'C'){
ans -= 10;
}else{
ans += 10;
}
}
if(c[i] == 'C'){
if(c[i + 1] == 'D' || c[i + 1] == 'M'){
ans -= 100;
}else{
ans += 100;
}
}
if(c[i] == 'V'){
ans += 5;
}
if(c[i] == 'L'){
ans += 50;
}
if(c[i] == 'D'){
ans += 500;
}
}
printf("%d\n",ans);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:21: error: 'strlen' was not declared in this scope
9 | n = strlen(c);
| ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <stdio.h>
+++ |+#include <cstring>
2 |
|
s622433356
|
p00039
|
C++
|
#include <stdio.h>
#include <string>
char c[200];
int main(){
int ans;
int n;
while(scanf("%s",&c) != EOF){
n = strlen(c);
ans = 0;
for(int i = 0; i < n; i++){
if(c[i] == 'I'){
if(c[i + 1] == 'V' || c[i + 1] == 'X'){
ans -= 1;
}else{
ans += 1;
}
}
if(c[i] == 'X'){
if(c[i + 1] == 'L' || c[i + 1] == 'C'){
ans -= 10;
}else{
ans += 10;
}
}
if(c[i] == 'C'){
if(c[i + 1] == 'D' || c[i + 1] == 'M'){
ans -= 100;
}else{
ans += 100;
}
}
if(c[i] == 'V'){
ans += 5;
}
if(c[i] == 'L'){
ans += 50;
}
if(c[i] == 'D'){
ans += 500;
}
}
printf("%d\n",ans);
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:10:21: error: 'strlen' was not declared in this scope
10 | n = strlen(c);
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <string>
+++ |+#include <cstring>
3 |
|
s027485808
|
p00039
|
C++
|
#include<stdio.h>
int main(){
char ch,;
int sum;
int w,b,a;
sum=0;ch='\0';w=0;b=0;a=0;
while(scanf("%c",&ch)!=EOF){
while(1){
if(ch=='\0')break;
if(ch=='I')w=1;
else if(ch=='V')w=5;
else if(ch=='X')w=10;
else if(ch=='L')w=50;
else if(ch=='C)w=100;
else if(ch=='D')w=500;
else if(ch=='M')w=1000;
switch(w){
case 1:
a=1;break;
case 5:
if(b==1)a=4;else a=5;break;
case 10:
if(b==1)a=9;else a=10;break;
case 50:
if(b==10)a=40;else a=50;break;
case 100:
if(b==10)a=90;else a=100;break;
case 500:
if(b==100)a=400;else a=500;break;
case 1000:
if(b==100)a=9;else a=1000;break;
}
sum+=a;b=a;
}
printf( "%d\n",sum);
sum=0;ch='\0';w=0;b=0;a=0;
}
return 0;
}
|
a.cc:15:13: warning: missing terminating ' character
15 | else if(ch=='C)w=100;
| ^
a.cc:15:13: error: missing terminating ' character
15 | else if(ch=='C)w=100;
| ^~~~~~~~~
a.cc: In function 'int main()':
a.cc:4:9: error: expected unqualified-id before ';' token
4 | char ch,;
| ^
a.cc:16:1: error: expected primary-expression before 'else'
16 | else if(ch=='D')w=500;
| ^~~~
a.cc:17:1: error: expected primary-expression before 'else'
17 | else if(ch=='M')w=1000;
| ^~~~
a.cc:16:23: error: expected ')' before 'else'
16 | else if(ch=='D')w=500;
| ^
| )
17 | else if(ch=='M')w=1000;
| ~~~~
a.cc:15:8: note: to match this '('
15 | else if(ch=='C)w=100;
| ^
|
s359234511
|
p00039
|
C++
|
#include <iostream>
#include <string>
using namespace std;
void Solution()
{
string str;
int a;
int b;
int l;
int x;
char c;
while (getline(cin, str)) //enter
{
x = 0;
l = (int)str.size();
for (int i = 0; i < l; i++)
{
c = str.at(i); //string text = "ABCDEF";
//char ch = text.at( 2 );
if (c == 'I') a = 1;
else if (c == 'V') a = 5;
else if (c == 'X') a = 10;
else if (c == 'L') a = 50;
else if (c == 'C') a = 100;
else if (c == 'D') a = 500;
else if (c == 'M') a = 1000;
if (i)
{
if (b >= a)
{
x += b;
}
else
{
x -= b;
}
}
b = a;
}
x += b;
cout << x << endl;
}
}
int main()
{
Solution()
return 0;
}
|
a.cc:23:18: error: extended character is not valid in an identifier
23 | for (int i = 0; i < l; i++)
| ^
a.cc:23:22: error: extended character is not valid in an identifier
23 | for (int i = 0; i < l; i++)
| ^
a.cc:23:27: error: extended character is not valid in an identifier
23 | for (int i = 0; i < l; i++)
| ^
a.cc:23:31: error: extended character is not valid in an identifier
23 | for (int i = 0; i < l; i++)
| ^
a.cc: In function 'void Solution()':
a.cc:23:22: error: '\U000030000' was not declared in this scope
23 | for (int i = 0; i < l; i++)
| ^~~
a.cc:23:31: error: '\U00003000l' was not declared in this scope
23 | for (int i = 0; i < l; i++)
| ^~~
a.cc:23:36: error: 'i' was not declared in this scope
23 | for (int i = 0; i < l; i++)
| ^
a.cc: In function 'int main()':
a.cc:60:15: error: expected ';' before 'return'
60 | Solution()
| ^
| ;
61 | return 0;
| ~~~~~~
|
s134191829
|
p00039
|
C++
|
import java.util.Scanner;
//Roman Figure
public class AOJ0039 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
char[] s = sc.next().toCharArray();
int sum = 0;
int i;
for(i=0;i<s.length-1;i++){
if(f(s[i])>=f(s[i+1]))sum+=f(s[i]);
else{
sum += f(s[i+1])-f(s[i]);
i++;
}
}
if(i<s.length)sum += f(s[i]);
System.out.println(sum);
}
}
public static int f(char c){
return c=='I'?1:
c=='V'?5:
c=='X'?10:
c=='L'?50:
c=='C'?100:
c=='D'?500:1000;
}
}
|
a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Scanner;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class AOJ0039 {
| ^~~~~~
|
s521267238
|
p00039
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
while(cin>>s){
int b[2][100000]={0};bool bb[2][100000]={0};
for(int i=0;i<100000;i++)for(j=0;j<2;j++)b[j][i]=0;
for(int i=0;i<100000;i++)for(j=0;j<2;j++)bb[j][i]=0;
int a[200],sum=0;
for(int i=0;i<200;i++)a[i]=0;
for(int i=0;i<s.size();i++){
int t;
if(s[i]=='I')t=1;
if(s[i]=='V')t=5;
if(s[i]=='X')t=10;
if(s[i]=='L')t=50;
if(s[i]=='C')t=100;
if(s[i]=='D')t=500;
if(s[i]=='M')t=1000;
a[i]=t;
if(i&&a[i]!=a[i-1]&&b[0][a[i]])b[1][t]++;
else b[0][t]++;
}
for(int i=s.size()-1;i>=0;i--){
if(sum<a[i]){
if(i!=s.size()-1&&a[i]!=a[i+1]&&bb[0][a[i]]){
sum-=b[1][a[i]]*a[i];
i-=b[1][a[i]]-1;
}
else{sum+=b[0][a[i]]*a[i];
i-=b[0][a[i]]-1;bb[0][a[i]]=1;}
}
else{
sum-=b[0][a[i]]*a[i];
i-=b[0][a[i]]-1;
bb[0][a[i]]=1;
}
}
cout<<sum<<endl;
}
}
|
a.cc: In function 'int main()':
a.cc:7:46: error: 'j' was not declared in this scope
7 | for(int i=0;i<100000;i++)for(j=0;j<2;j++)b[j][i]=0;
| ^
a.cc:8:46: error: 'j' was not declared in this scope
8 | for(int i=0;i<100000;i++)for(j=0;j<2;j++)bb[j][i]=0;
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.