submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s079141691 | p00180 | C++ | #include <iostream>
#include <vector>
using namespace std;
struct Edge {
int from, to, cost;
Edge() : from(0), to(0), cost(0) { }
Edge(int from, int to, int cost) : from(from), to(to), cost(cost) { }
};
struct UnionFind {
vector<int> data;
UnionFind(int n) : data(n, -1) { }
bool same(int i, int j) {
return root(i) == root(j);
}
int root(int i) {
return data[i] < 0 ? i : data[i] = root(data[i]);
}
void join(int i, int j) {
data[root(i)] += data[root(j)];
data[root(j)] = root(i);
}
};
int main() {
for(int n, m; cin >> n >> m && n; ) {
vector<Edge> edges(m);
for(int i = 0; i < m; i++) {
cin >> edges[i].from >> edges[i].to >> edges[i].cost;
}
sort(edges.begin(), edges.end(), [](const Edge& a, const Edge& b) {
return a.cost < b.cost;
});
int cost = 0;
UnionFind uf(n);
for(auto it = edges.begin(); it != edges.end(); it++) {
if(!uf.same(it->from, it->to)) {
uf.join(it->from, it->to);
cost += it->cost;
}
}
cout << cost << endl;
}
} | a.cc: In function 'int main()':
a.cc:38:5: error: 'sort' was not declared in this scope; did you mean 'short'?
38 | sort(edges.begin(), edges.end(), [](const Edge& a, const Edge& b) {
| ^~~~
| short
|
s446663356 | p00180 | C++ | #include <iostream>
#incldue <cstdio>
#define rep(i,n) for(int i=0;i<n;i++)
//#define int long long
using namespace std;
#define INF 999999
int n, m;
int a, b, c;
int cost[100][100];
int mincost[100];
bool used[100];
void init()
{
rep(i,100) rep(j,100)
{
cost[i][j] = INF;
}
}
int prim()
{
rep(i,n)
{
mincost[i] = INF;
used[i] = false;
}
mincost[0] = 0;
int res = 0;
while (true)
{
int v = -1;
rep(u,n)
{
if (!used[u] && (v == -1 || mincost[u] < mincost[v])) v = u;
}
if (v == -1) break;
used[v] = true;
res += mincost[v];
rep(u,n)
{
mincost[u] = min(mincost[u], cost[v][u]);
}
}
return res;
}
int main()
{
while (true)
{
cin >> n >> m;
if (n == 0 && m == 0) break;
init();
rep(i,m)
{
cin >> a >> b >> c;
cost[a][b] = c;
cost[b][a] = c;
}
printf("%d\n", prim());
}
} | a.cc:2:2: error: invalid preprocessing directive #incldue; did you mean #include?
2 | #incldue <cstdio>
| ^~~~~~~
| include
|
s602590928 | p00180 | C++ | #include "Graph.hpp"
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
Graph creat_graph(int n, int m);
int search_prim(Graph prim, int n);
vector<int> ans;
vector<vector<int>> cost(100,vector<int>(100,0));
int main(){
int n,m;
while(cin >> n >> m, n){
Graph prim = creat_graph(n,m); /*creat graph*/
ans.push_back(search_prim(prim,n)); /*make answer*/
}
for(int i: ans){
cout << i << endl;
}
return 0;
}
Graph creat_graph(int n,int m){
Graph prim(n);
int a,b,cost_t;
for(int i=0; i<m; i++){
cin >> a >> b >> cost_t;
prim.connect(a,b);
cost[a][b] = cost_t;
cost[a][b] = cost_t;
}
return prim;
}
int search_prim(Graph prim, int n){
int current,cost_sum;
typedef pair<int, int> PII;
vector<bool> frag(n,false);
priority_queue < PII, vector < pair <int, int> >, greater < pair <int, int> > > que;
/*cost,next_node*/
cost_sum = 0;
current = 0;
frag[0] = true;
for(int k=0; k<n-1; ++k){
vector<int> near = prim.neighbours(current);
for(int j:near){
que.push(PII(cost[current][j],j));
}
while(1){
if(frag[que.top().second] == false){
cost_sum += que.top().first;
frag[que.top().second] = true;
current = que.top().second;
break;
}
}
que.pop();
}
return cost_sum;
}
| a.cc:1:10: fatal error: Graph.hpp: No such file or directory
1 | #include "Graph.hpp"
| ^~~~~~~~~~~
compilation terminated.
|
s382925449 | p00180 | C++ |
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
Graph creat_graph(int n, int m);
int search_prim(Graph prim, int n);
vector<int> ans;
vector<vector<int>> cost(100,vector<int>(100,0));
class Graph {
private:
const static int INF = 1000000;
std::vector<std::vector<int> > edge_;
unsigned int size_;
public:
Graph(unsigned int size);
Graph& connect(int from, int to, int weight);
std::vector<int> neighbours(int node) const;
unsigned int size() const;
};
const int Graph::INF;
Graph::Graph(unsigned int size) {
size_ = size;
edge_ = std::vector<std::vector<int> > (size_, std::vector<int>(size_, INF));
}
Graph& Graph::connect(int from, int to, int weight = 1) {
edge_[from][to] = weight;
return *this;
}
std::vector<int> Graph::neighbours(int node) const {
std::vector<int> neighbours;
for (int i = 0; i < static_cast<int>(size_); ++i)
if (edge_[node][i] < INF) neighbours.push_back(i);
return neighbours;
}
unsigned int Graph::size() const {
return size_;
}
int main(){
int n,m;
while(cin >> n >> m, n){
Graph prim = creat_graph(n,m); /*creat graph*/
ans.push_back(search_prim(prim,n)); /*make answer*/
}
for(int i: ans){
cout << i << endl;
}
return 0;
}
Graph creat_graph(int n,int m){
Graph prim(n);
int a,b,cost_t;
for(int i=0; i<m; i++){
cin >> a >> b >> cost_t;
prim.connect(a,b);
cost[a][b] = cost_t;
cost[a][b] = cost_t;
}
return prim;
}
int search_prim(Graph prim, int n){
int current,cost_sum;
typedef pair<int, int> PII;
vector<bool> frag(n,false);
priority_queue < PII, vector < pair <int, int> >, greater < pair <int, int> > > que;
/*cost,next_node*/
cost_sum = 0;
current = 0;
frag[0] = true;
for(int k=0; k<n-1; ++k){
vector<int> near = prim.neighbours(current);
for(int j:near){
que.push(PII(cost[current][j],j));
}
while(1){
if(frag[que.top().second] == false){
cost_sum += que.top().first;
frag[que.top().second] = true;
current = que.top().second;
break;
}
}
que.pop();
}
return cost_sum;
}
| a.cc:7:1: error: 'Graph' does not name a type
7 | Graph creat_graph(int n, int m);
| ^~~~~
a.cc:8:17: error: 'Graph' was not declared in this scope; did you mean 'isgraph'?
8 | int search_prim(Graph prim, int n);
| ^~~~~
| isgraph
a.cc:8:29: error: expected primary-expression before 'int'
8 | int search_prim(Graph prim, int n);
| ^~~
a.cc:8:34: error: expression list treated as compound expression in initializer [-fpermissive]
8 | int search_prim(Graph prim, int n);
| ^
a.cc: In function 'int main()':
a.cc:54:18: error: 'creat_graph' was not declared in this scope
54 | Graph prim = creat_graph(n,m); /*creat graph*/
| ^~~~~~~~~~~
a.cc:55:30: error: 'search_prim' cannot be used as a function
55 | ans.push_back(search_prim(prim,n)); /*make answer*/
| ~~~~~~~~~~~^~~~~~~~
a.cc: At global scope:
a.cc:78:34: error: 'int search_prim(Graph, int)' redeclared as different kind of entity
78 | int search_prim(Graph prim, int n){
| ^
a.cc:8:5: note: previous declaration 'int search_prim'
8 | int search_prim(Graph prim, int n);
| ^~~~~~~~~~~
|
s271671907 | p00180 | C++ | import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import qualified Data.Set as Set
--import qualified Data.Sequence as Sequence
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
--import Data.Array
--import Data.Array.Unboxed
import Data.Array.IArray
import Data.Array.MArray
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
-- templete
readInt = read :: String -> Int
readInteger = read :: String -> Integer
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getInteger = readLn :: IO Integer
getIntegers = map readInteger . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
apply4 :: (a -> a -> a -> a -> b) -> [a] -> b
apply4 f [x,y,z,w] = f x y z w
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
binMap :: (a -> a -> b) -> [a] -> [b]
binMap f (x:xs@(y:_)) = f x y : binMap f xs
binMap _ _ = []
splitRec :: Int -> [a] -> [[a]]
splitRec _ [] = []
splitRec n xs = let (y,ys) = splitAt n xs in y : splitRec n ys
infixl 7 `divCeil`
divCeil :: Integral a => a -> a -> a
x `divCeil` y = (x+y-1) `div` y
-- templete
newUF n = newArray (0,n-1) (-1)
root uf i = do
c <- readArray uf i
if c==(-1) then return i else root uf c >>= writeArray uf i >> readArray uf i
same uf i j = (==) <$> root uf i <*> root uf j
unite uf i j = root uf i >>= writeArray uf j
kruskal n es = runST $ do
uf <- newUF n :: ST s (STUArray s Int Int)
cost <- newSTRef 0
forM_ es $ \(c, (a, b)) -> do
s <- same uf a b
unless s $ do
modifySTRef cost (+c)
unite uf a b
readSTRef cost
type Edge = (Int, (Int,Int))
edge a b cost = (cost, (a, b))
main = do
[n, m] <- getInts
when (n/=0 || m/=0) $ do
es <- sort . map (apply3 edge) <$> replicateM m getInts
print $ kruskal n es
main
| a.cc:51:20: error: stray '\' in program
51 | replace x y = map (\z -> if z==x then y else z)
| ^
a.cc:53:15: error: stray '@' in program
53 | binMap f (x:xs@(y:_)) = f x y : binMap f xs
| ^
a.cc:58:10: error: stray '`' in program
58 | infixl 7 `divCeil`
| ^
a.cc:58:18: error: stray '`' in program
58 | infixl 7 `divCeil`
| ^
a.cc:60:3: error: stray '`' in program
60 | x `divCeil` y = (x+y-1) `div` y
| ^
a.cc:60:11: error: stray '`' in program
60 | x `divCeil` y = (x+y-1) `div` y
| ^
a.cc:60:25: error: stray '`' in program
60 | x `divCeil` y = (x+y-1) `div` y
| ^
a.cc:60:29: error: stray '`' in program
60 | x `divCeil` y = (x+y-1) `div` y
| ^
a.cc:76:16: error: stray '\' in program
76 | forM_ es $ \(c, (a, b)) -> do
| ^
a.cc:1:1: error: 'import' does not name a type
1 | import Control.Applicative
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s798482828 | p00180 | C++ | #include<iostream>
#include<queue>
#include<vector>
using namespace std;
class Load{
public:
int n,m,o,p;
load(){p=0;}
load(int a,int b){n=a;m=b;p=0;}
};
int n,m;
Load load[100];
int prim(){
vector<int> visit;
visit.push_back(0);
int cont=0;
while(1){
if(visit.size()==n){
break;
}
int maxi=1000000000;
int maxo=0;
int maxa=0;
for(int i=0;i<m;i++){
for(int j=0;j<visit.size();j++){
if(load[i].n==visit[j]&&load[i].p==0){
if(maxi>load[i].o){
load[i].p=1;
maxi=load[i].o;
maxo=load[i].m;
maxa=i;
}
}
if(load[i].m==visit[j]&&load[i].p==0){
if(maxi>load[i].o){
load[i].p=1;
maxi=load[i].o;
maxo=load[i].n;
maxa=i;
}
}
}
}
//printf("%d %d %d\n",maxa,maxo,maxi);
cont+=maxi;
visit.push_back(maxo);
}
return cont;
}
int main(){
while(1){
cin>>n>>m;
if(!n){
break;
}
for(int i=0;i<m;i++){
int a,b,c;
cin>>a>>b>>c;
load[i].n=a;
load[i].m=b;
load[i].o=c;
load[i].p=0;
}
printf("%d\n",prim());
}
} | a.cc:10:9: error: ISO C++ forbids declaration of 'load' with no type [-fpermissive]
10 | load(){p=0;}
| ^~~~
a.cc:11:9: error: ISO C++ forbids declaration of 'load' with no type [-fpermissive]
11 | load(int a,int b){n=a;m=b;p=0;}
| ^~~~
a.cc: In member function 'int Load::load()':
a.cc:10:20: warning: no return statement in function returning non-void [-Wreturn-type]
10 | load(){p=0;}
| ^
a.cc: In member function 'int Load::load(int, int)':
a.cc:11:39: warning: no return statement in function returning non-void [-Wreturn-type]
11 | load(int a,int b){n=a;m=b;p=0;}
| ^
|
s068484073 | p00180 | C++ | #include<iostream>
#include<vector>
#include<cstdio>
#include<cmath>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
using namespace std;
typedef unsigned long long ull;
int main(){
int n,m;
while(scanf("%d%d",&n,&m),n+m){
int cost[n][n];
bool f[n];
memset(cost, 0, sizeof(cost));
memset(f, 0, sizeof(f));
REP(i,m){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
cost[a][b] = cost[b][a] = c;
}
f[0] = true;
int ans = 0;
REP(i,n-1){
int m = INT_MAX;
int ii,jj;
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
if(f[i] ^ f[j] && cost[i][j] != 0){
if(m > cost[i][j]){
ii = i; jj = j;
m = cost[i][j];
}
}
}
}
f[ii] = f[jj] = true;
ans += m;
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:5: error: 'memset' was not declared in this scope
17 | memset(cost, 0, sizeof(cost));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<cmath>
+++ |+#include <cstring>
5 |
a.cc:27:15: error: 'INT_MAX' was not declared in this scope
27 | int m = INT_MAX;
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include<cmath>
+++ |+#include <climits>
5 |
|
s338825282 | p00180 | C++ | #include <iostream>
#include <map>
#include <vector>
using namespace std;
int data[101][101];
int prim( int n )
{
vector<int> key( n, numeric_limits<int>::max() );
key[0] = 0;
vector<int> pq;
vector<bool> inQueue( n, true );
for( int i = 0;i < n;i++ ){
pq.push_back( key[i] );
}
while( !pq.empty() ){
vector<int>::iterator it = min_element( pq.begin(), pq.end() );
int u = distance( pq.begin(), it );
pq.erase( it );
inQueue[u] = false;
for( int i = 0;i < n;i++ ){
if( data[u][i] ){
if( inQueue[i] ){
int w = data[u][i];
if( w < key[i] ){
key[i] = w;
pq[i] = w;
}
}
}
}
}
int answer = 0;
for( int i = 0;i < n;i++ ){
answer += key[i];
}
return answer;
}
int main(int argc, char const* argv[])
{
int n,m;
int a,b,cost;
while( cin >> n >> m && n != 0 ){
for( int i = 0;i < 101;i++ ){
for( int j = 0;j < 101;j++ ){
data[i][j] = 0;
}
}
for( int i = 0;i < m;i++ ){
cin >> a >> b >> cost;
data[a][b] = cost;
data[b][a] = cost;
}
int answer = prim( n );
cout << answer << endl;
}
return 0;
} | a.cc: In function 'int prim(int)':
a.cc:11:29: error: 'numeric_limits' was not declared in this scope
11 | vector<int> key( n, numeric_limits<int>::max() );
| ^~~~~~~~~~~~~~
a.cc:11:44: error: expected primary-expression before 'int'
11 | vector<int> key( n, numeric_limits<int>::max() );
| ^~~
a.cc:20:44: error: 'min_element' was not declared in this scope
20 | vector<int>::iterator it = min_element( pq.begin(), pq.end() );
| ^~~~~~~~~~~
a.cc:26:29: error: reference to 'data' is ambiguous
26 | if( data[u][i] ){
| ^~~~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:5: note: 'int data [101][101]'
7 | int data[101][101];
| ^~~~
a.cc:28:49: error: reference to 'data' is ambiguous
28 | int w = data[u][i];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:5: note: 'int data [101][101]'
7 | int data[101][101];
| ^~~~
a.cc: In function 'int main(int, const char**)':
a.cc:54:33: error: reference to 'data' is ambiguous
54 | data[i][j] = 0;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:5: note: 'int data [101][101]'
7 | int data[101][101];
| ^~~~
a.cc:59:25: error: reference to 'data' is ambiguous
59 | data[a][b] = cost;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:5: note: 'int data [101][101]'
7 | int data[101][101];
| ^~~~
a.cc:60:25: error: reference to 'data' is ambiguous
60 | data[b][a] = cost;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:5: note: 'int data [101][101]'
7 | int data[101][101];
| ^~~~
|
s413569205 | p00180 | C++ | #include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
int data[101][101];
int prim( int n )
{
vector<int> key( n, numeric_limits<int>::max() );
key[0] = 0;
vector<int> pq;
vector<bool> inQueue( n, true );
for( int i = 0;i < n;i++ ){
pq.push_back( key[i] );
}
while( !pq.empty() ){
vector<int>::iterator it = min_element( pq.begin(), pq.end() );
int u = distance( pq.begin(), it );
pq.erase( it );
inQueue[u] = false;
for( int i = 0;i < n;i++ ){
if( data[u][i] ){
if( inQueue[i] ){
int w = data[u][i];
if( w < key[i] ){
key[i] = w;
pq[i] = w;
}
}
}
}
}
int answer = 0;
for( int i = 0;i < n;i++ ){
answer += key[i];
}
return answer;
}
int main(int argc, char const* argv[])
{
int n,m;
int a,b,cost;
while( cin >> n >> m && n != 0 ){
for( int i = 0;i < 101;i++ ){
for( int j = 0;j < 101;j++ ){
data[i][j] = 0;
}
}
for( int i = 0;i < m;i++ ){
cin >> a >> b >> cost;
data[a][b] = cost;
data[b][a] = cost;
}
int answer = prim( n );
cout << answer << endl;
}
return 0;
} | a.cc: In function 'int prim(int)':
a.cc:13:29: error: 'numeric_limits' was not declared in this scope
13 | vector<int> key( n, numeric_limits<int>::max() );
| ^~~~~~~~~~~~~~
a.cc:13:44: error: expected primary-expression before 'int'
13 | vector<int> key( n, numeric_limits<int>::max() );
| ^~~
a.cc:28:29: error: reference to 'data' is ambiguous
28 | if( data[u][i] ){
| ^~~~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [101][101]'
9 | int data[101][101];
| ^~~~
a.cc:30:49: error: reference to 'data' is ambiguous
30 | int w = data[u][i];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [101][101]'
9 | int data[101][101];
| ^~~~
a.cc: In function 'int main(int, const char**)':
a.cc:56:33: error: reference to 'data' is ambiguous
56 | data[i][j] = 0;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [101][101]'
9 | int data[101][101];
| ^~~~
a.cc:61:25: error: reference to 'data' is ambiguous
61 | data[a][b] = cost;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [101][101]'
9 | int data[101][101];
| ^~~~
a.cc:62:25: error: reference to 'data' is ambiguous
62 | data[b][a] = cost;
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:9:5: note: 'int data [101][101]'
9 | int data[101][101];
| ^~~~
|
s599623485 | p00180 | C++ | #include<iostream>
#include<vector>
#include<set>
using namespace std;
#define NONE 0
int prim(int n, vector< vector<int> >v)
{
set<int>selected;
set<int>::iterator it;
int mincost,mini;
int i;
int ans=0;
selected.insert(0);
while(selected.size()!=n){
mincost=INT_MAX;
mini=NONE;
for(it=selected.begin();it!=selected.end();it++){
for(i=0;i<n;i++){
if(selected.find(i)!=selected.end())continue;
if(v[*it][i]==NONE)continue;
if(v[*it][i]>=mincost)continue;
mincost=v[*it][i];
mini=i;
}
}
if(mini==NONE)break;
selected.insert(mini);
ans+=mincost;
}
return ans;
}
int main()
{
int n,m,a,b,cost;
int i;
while(cin>>n>>m,n|m){
vector< vector<int> >v(n,vector<int>(n,NONE));
for(i=0;i<m;i++){
cin>>a>>b>>cost;
v[a][b]=v[b][a]=cost;
}
cout<<prim(n,v)<<endl;
}
} | a.cc: In function 'int prim(int, std::vector<std::vector<int> >)':
a.cc:19:13: error: 'INT_MAX' was not declared in this scope
19 | mincost=INT_MAX;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include<set>
+++ |+#include <climits>
4 | using namespace std;
|
s194996420 | p00180 | C++ | #include <stdio.h>
#define MAX 101
struct Dis
{
int pa[MAX];
int used[MAX];
int n;
Dis(int n):n(n)
{
for(int i=0;i<n;i++)
{
pa[i]=i;
used[i]=0;
}
}
void use(int i)
{
used[i]=1;
}
int root(int a)
{
if(pa[a]==a)
return a;
return pa[a]=root(pa[a]);
}
bool is_same_set(int a,int b)
{
return root(a)==root(b);
}
void unite(int n,int m)
{
use(n);
use(m);
pa[root(n)]=root(m);
}
bool is_connected()
{
int rt=-1;
for(int i=0;i<n;i++)
{
if(rt>=0 &&used[i] && rt!=root(i))
return false;
if(used[i])
rt=root(i);
}
return rt!=-1;
}
};
int br[6000][3];
int getMin(int m)
{
int tmp=-1;
for(int i=0;i<m;i++)
{
if(br[i][2]!=-1)
{
if(tmp==-1 || br[tmp][2]>=br[i][2])
{
tmp=i;
}
}
}
if(tmp!=-1)
{
return tmp;
}
}
int main(void)
{
int n,m;
while(scanf("%d%d",&n,&m)==2 && n && m)
{
Dis dis(n);
for(int i=0;i<m;i++)
{
scanf("%d%d%d",br[i],br[i]+1,br[i]+2);
}
int nc=0;
int cost=0;
while(nc<n)
{
int min=getMin();
int a=br[min][0];
int b=br[min][1];
if(!dis.is_same_set(a,b))
{
dis.unite(a,b);
nc++;
cost+=br[min][2];
br[min][2]=-1;
}
}
printf("%d\n",cost);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:87:27: error: too few arguments to function 'int getMin(int)'
87 | int min=getMin();
| ~~~~~~^~
a.cc:54:5: note: declared here
54 | int getMin(int m)
| ^~~~~~
a.cc: In function 'int getMin(int)':
a.cc:71:1: warning: control reaches end of non-void function [-Wreturn-type]
71 | }
| ^
|
s437082113 | p00180 | C++ | #include<algorithm>
#include<vector>
using namespace std;
struct edge{int u,v,cost;};
int par[101],rank[101];
edge es[200];
int V,E;
void init_union_find(int n){for(int i=0;i<n;i++)par[i]=i,rank[i]=0;}
int find(int x){
if(par[x]==x)return x;
else return par[x]=find(par[x]);
}
void unite(int x,int y){
x=find(x),y=find(y);
if(x==y)return;
if(rank[x] < rank[y])par[x]=y;
else par[y]=x,rank[x]+=(rank[x]==rank[y]);
}
bool same(int x,int y){return find(x)==find(y);}
bool comp(const edge& e1,const edge& e2){return e1.cost < e2.cost;}
int kruskal(){
sort(es,es+E,comp);
init_union_find(V);
int res=0;
for(int i=0;i<E;i++){
edge e=es[i];
if(!same(e.u,e.v))unite(e.u,e.v),res+=e.cost;
}
return res;
}
int main(void){
int a,b,c;
while(cin >> V >> E && V){
for(int i=0;i<E;i++){
cin >> a >> b >> c;
es[i].u=a,es[i].v=b,es[i].cost=c;
}
cout << kruskal() << endl;
}
return 0;
} | a.cc: In function 'void init_union_find(int)':
a.cc:12:58: error: reference to 'rank' is ambiguous
12 | void init_union_find(int n){for(int i=0;i<n;i++)par[i]=i,rank[i]=0;}
| ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/algorithm:60,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:14: note: 'int rank [101]'
8 | int par[101],rank[101];
| ^~~~
a.cc: In function 'void unite(int, int)':
a.cc:22:6: error: reference to 'rank' is ambiguous
22 | if(rank[x] < rank[y])par[x]=y;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:14: note: 'int rank [101]'
8 | int par[101],rank[101];
| ^~~~
a.cc:22:16: error: reference to 'rank' is ambiguous
22 | if(rank[x] < rank[y])par[x]=y;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:14: note: 'int rank [101]'
8 | int par[101],rank[101];
| ^~~~
a.cc:23:17: error: reference to 'rank' is ambiguous
23 | else par[y]=x,rank[x]+=(rank[x]==rank[y]);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:14: note: 'int rank [101]'
8 | int par[101],rank[101];
| ^~~~
a.cc:23:27: error: reference to 'rank' is ambiguous
23 | else par[y]=x,rank[x]+=(rank[x]==rank[y]);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:14: note: 'int rank [101]'
8 | int par[101],rank[101];
| ^~~~
a.cc:23:36: error: reference to 'rank' is ambiguous
23 | else par[y]=x,rank[x]+=(rank[x]==rank[y]);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:8:14: note: 'int rank [101]'
8 | int par[101],rank[101];
| ^~~~
a.cc: In function 'int main()':
a.cc:44:9: error: 'cin' was not declared in this scope
44 | while(cin >> V >> E && V){
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<vector>
+++ |+#include <iostream>
3 |
a.cc:49:5: error: 'cout' was not declared in this scope
49 | cout << kruskal() << endl;
| ^~~~
a.cc:49:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:49:26: error: 'endl' was not declared in this scope
49 | cout << kruskal() << endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include<vector>
+++ |+#include <ostream>
3 |
|
s596800845 | p00181 | Java | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll m, n;
ll w[110];
bool check(ll mid){
ll sum=0, count=1;
for(ll i=1; i<=n; i++){
if(w[i]>mid) return false;
sum+=w[i];
if(sum>mid){
count++;
sum=w[i];
}
}
return count<=m;
}
int main(void){
while(cin >> m >> n){
if(m+n==0) break;
for(int i=1; i<=n; i++){
cin >> w[i];
}
ll under=0, upper=1500000;
while(upper-under>1LL){
ll mid=(under+upper)/2;
if(! check(mid)){
under=mid;
}
else{
upper=mid;
}
}
cout << upper << "\n";
}
return 0;
}
| Main.java:1: error: illegal character: '#'
#include<bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<bits/stdc++.h>
^
Main.java:4: error: class, interface, enum, or record expected
typedef long long ll;
^
Main.java:6: error: class, interface, enum, or record expected
ll m, n;
^
Main.java:7: error: class, interface, enum, or record expected
ll w[110];
^
Main.java:9: error: unnamed classes are a preview feature and are disabled by default.
bool check(ll mid){
^
(use --enable-preview to enable unnamed classes)
Main.java:26: error: not a statement
cin >> w[i];
^
Main.java:29: error: not a statement
while(upper-under>1LL){
^
Main.java:40: error: not a statement
cout << upper << "\n";
^
Main.java:22: error: <identifier> expected
int main(void){
^
Main.java:29: error: ';' expected
while(upper-under>1LL){
^
11 errors
|
s711793272 | p00181 | Java |
import java.util.Scanner;
//Persistence
public class AOJ0181 {
static int[] w;
static int n, m;
static boolean f(int W){
int need = 1;
int s = 0;
for(int i=0;i<n;i++){
if(w[i]>W)return false;
if(s+w[i]>W){
need++;
s = 0;
}
s+=w[i];
}
return need <= m;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(true){
m = sc.nextInt();
n = sc.nextInt();
if((m|n)==0)break;
w = new int[n];
for(int i=0;i<n;i++)w[i]=sc.nextInt();
int l = 1;
int r = 1500000;
while(r-l>1){
int mid = (l+r)/2;
if(f(mid))r = mid;
else l = mid;
}
System.out.println(f(l)?l:r);
}
}
} | Main.java:5: error: class AOJ0181 is public, should be declared in a file named AOJ0181.java
public class AOJ0181 {
^
1 error
|
s578035816 | p00181 | C | #include <cstdio>
using namespace std;
int bookin(int* books,int m,int w,int n);
int main(void)
{
int n,m;
for(;;){
scanf("%d %d",&m,&n);
if(n==0)return 0;
int books[n];
for(int i=0;i<n;i++){
scanf("%d",&books[i]);
}
int low = 1,high=1500000;
for(int i=0;i<100;i++){
int mid = (low+high)/2;
int midval = bookin(books,m,mid,n);
if(midval==0)low = mid;
else high = mid;
}
printf("%d\n",high);
}
}
int bookin(int* books,int m,int w,int n)
{
int haba=w;
for(int i=0;i<n;i++){
haba-=books[i];
if(haba<0){i--;m--;haba=w;}
if(m<=0)return 0;
}
return 1;
}
| main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s040527891 | p00181 | C | 3 9
500
300
800
200
100
600
900
700
400
4 3
1000
1000
1000
0 0 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 3 9
| ^
|
s602733269 | p00181 | C | #include<stdio.h>
#include<math.h>
int w[100];
int m, n;
int func(int h) {
int i=0, sum = 0,count=0;
while(i<n && count < m){
if (h >= sum + w[i])
sum += w[i++];
else {
sum = 0;
count++;
}
}
return i == n && count < m;
}
int binsearch_func(int low, int hight) {
int i;
for (i = 0; i < 100; i++) {
int mid = (low + hight) / 2;
int midval = func(mid);
if (midval)hight = mid;
else low = mid;
}
return max(low,hight);
}
int main(void)
{
int sum;
int i;
while (1) {
scanf("%d %d", &m, &n);
if (m == 0 && n == 0)break;
sum = 0;
for (i = 0; i < n; i++) {
scanf("%d",&w[i]);
sum += w[i];
}
printf("%d\n", binsearch_func(0, 10000000));
}
return 0;
} | main.c: In function 'binsearch_func':
main.c:29:16: error: implicit declaration of function 'max'; did you mean 'fmax'? [-Wimplicit-function-declaration]
29 | return max(low,hight);
| ^~~
| fmax
|
s095432644 | p00181 | C | //suhan lee, saitama university;
#include <iostream>
using namespace std;
int putbook(int *list,int bookwi,int stair,int width){
int dara[20];
int j=0;
for(int i=0;i<20;i++)
dara[i]=0;
for(int i=0;i<bookwi;i++)
if(dara[j]+list[i]<=width)
dara[j]+=list[i];
else if(list[i]>width){
//cout <<"too big book"<<endl;
return 0;
}
else dara[++j]+=list[i];
// cout <<"hondara";
for(int i=0;i<stair;i++)
// cout <<dara[i]<<endl;
// cout <<"kugiri";
if(j<stair) return 1;// no problem
else return 0;
}
int main(){
int list[100];
int bookwi,stair,temp;
int max,min;
while(1){
cin >>stair>>bookwi;
if(bookwi==0&&stair==0)
return 0;
for(int i=0;i<bookwi;i++)
cin>>list[i];
max=1000000;
min=1;
//cout << putbook( list,bookwi,stair,1800 )<<endl;
while(1){
if(min==max) break;
if(putbook( list,bookwi,stair, ( max+min)/2 ) )
max=(max+min)/2;
else min= (max+min)/2+1;
// cout <<endl<<max<<" max&min "<<min<<endl;
}
cout <<max<<endl;
}
} | main.c:2:10: fatal error: iostream: No such file or directory
2 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s899997995 | p00181 | C++ | ?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define INF 99999999
int m,n;
int b[110];
bool solve(int v){
int l=0;
int x=v;
rep(i,n){
while(x<b[i]&&l<m){
x=v;
l++;
}
if(l>=m)return false;
if(x>=b[i]){
x-=b[i];
}
}
return true;
}
int main(){
while(cin>>m>>n){
if(m==0&&m==0)break;
rep(i,n)cin>>b[i];
int left=0;
int right=1500000-1;
while(right>left+1){
// cout<<left<<" "<<right<<endl;
int cent=(left+right)/2;
bool res = solve(cent);
if(res) right=cent;
else left=cent;
}
cout<<right<<endl;
}
} | a.cc:1:1: error: expected unqualified-id before '?' token
1 | ?
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:47:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/ |
s093216951 | p00181 | C++ | #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;
//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
int main() {
while (1) {
int M, N; cin >> M >> N;
if (!M)break;
vector<int>as;
for (int i = 0; i < N; ++i) {
int a; cin >> a;
as.emplace_back(a);
}
int amin = *max_element(as.begin(),as.end())-1; int amax = 1500001;
while (amin + 1 != amax) {
int amid = (amin + amax) / 2;
{
int h = 0;
int num = 0;
for (int b = 0; b < N; ++b) {
if (as[b] + num > amid) {
h++;
num = as[b];
}
else {
num += asa[b];
}
}
if (h >= M) {
amin = amid;
}
else {
amax = amid;
}
}
}
cout << amax << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:56: error: 'asa' was not declared in this scope; did you mean 'as'?
34 | num += asa[b];
| ^~~
| as
|
s412225854 | p00181 | C++ | import Control.Monad
import Control.Applicative
main :: IO ()
main = do
[m, n] <- getInts
if (m == 0 && n == 0) then return ()
else do
ss <- getIntLines n
print $ rolve m ss
main
rolve m ss = bin_search (kuwa ss m) 0 1000000
kuwa xs m n = func xs m n n
where
func (x:xs) m n l
| m <= 0 = False
| m > 0 && xs == [] && n - x >= 0 = True
| n - x >= 0 = func xs m (n - x) l
| n - x < 0 = func (x:xs) (m - 1) l l
bin_search func min max
| (max - min == 1) && (func min) = min
| (max - min == 1) && (func max) = max
| func center = bin_search func min center
| not (func center) = bin_search func center max
where
center = div (min + max) 2
---
getInt :: IO Integer
getInt = read <$> getLine
getInts :: IO [Integer]
getInts = map read . words <$> getLine
getIntLines :: Integral a => a -> IO [Integer]
getIntLines n = replicateM (fromIntegral n :: Int) getInt | a.cc:1:1: error: 'import' does not name a type
1 | import Control.Monad
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s174006559 | p00181 | C++ | import Control.Applicative
main :: IO ()
main = do
[m, n] <- getInts
if (m == 0 && n == 0) then return ()
else do
ss <- getIntLines n
print $ rolve m ss
main
rolve m ss = bin_search (kuwa ss m) 0 1000000
kuwa xs m n = func xs m n n
where
func (x:xs) m n l
| m <= 0 = False
| m > 0 && xs == [] && n - x >= 0 = True
| n - x >= 0 = func xs m (n - x) l
| n - x < 0 = func (x:xs) (m - 1) l l
bin_search func min max
| (max - min == 1) && (func min) = min
| (max - min == 1) && (func max) = max
| func center = bin_search func min center
| not (func center) = bin_search func center max
where
center = div (min + max) 2
---
getInt :: IO Integer
getInt = read <$> getLine
getInts :: IO [Integer]
getInts = map read . words <$> getLine
getIntLines :: Integral a => a -> IO [Integer]
getIntLines n = replicateM (fromIntegral n :: Int) getInt | a.cc:1:1: error: 'import' does not name a type
1 | import Control.Applicative
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s563212247 | p00181 | C++ |
main :: IO ()
main = do
[m, n] <- getInts
if (m == 0 && n == 0) then return ()
else do
ss <- getIntLines n
print $ rolve m ss
main
rolve m ss = bin_search (kuwa ss m) 0 1000000
kuwa xs m n = func xs m n n
where
func (x:xs) m n l
| m <= 0 = False
| m > 0 && xs == [] && n - x >= 0 = True
| n - x >= 0 = func xs m (n - x) l
| n - x < 0 = func (x:xs) (m - 1) l l
bin_search func min max
| (max - min == 1) && (func min) = min
| (max - min == 1) && (func max) = max
| func center = bin_search func min center
| not (func center) = bin_search func center max
where
center = div (min + max) 2
---
getInt :: IO Integer
getInt = read <$> getLine
getInts :: IO [Integer]
getInts = map read . words <$> getLine
getIntLines :: Integral a => a -> IO [Integer]
getIntLines n = replicateM (fromIntegral n :: Int) getInt | a.cc:2:1: error: 'main' does not name a type
2 | main :: IO ()
| ^~~~
|
s816958048 | p00181 | C++ | #include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int n,m,a[101];
bool nibun(int x){
int s=0,q=0,t=0;
r(i,n){
if(s+a[i]<=x)s+=a[i];
else s=0,q++,i--,t++;
if(t>1000)return 0;
}
return m>=q+1;
}
main(){
while(cin>>m>>n,m){
y=1e9;
r(i,n)cin>>a[i];
int l=0,r=1500001;
while(l<r){
int mid=(l+r)/2;
if(nibun(mid))r=mid;
else l=mid+1;
}
cout<<l<<endl;
}
} | a.cc:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:16:11: error: 'y' was not declared in this scope; did you mean 'yn'?
16 | y=1e9;
| ^
| yn
|
s018410716 | p00181 | C++ | #include <iostream>
#include <map>
using namespace std;
int m,n,*b,*l,mp;
map<int,int> hk;
int max(){
int tmp = l[0];
for(int i=1; i<m; i++)
if(tmp < l[i])
tmp = l[i];
return tmp;
}
void solve(){
mp = 0;
int k;
l[0] = 0;
for(int i=0; i<n; i++){
k = i+1;
l[0] += b[i];
for(int j=1; j<m-1; j++){
l[j] = 0;
for(; k<n; k++){
l[j] += b[k];
if(k == n-1){
k++;
break;
}
if((l[0] - l[j] >= 0 && l[0] - l[j] < l[j] + b[k+1] - l[0];)||(l[j] >= l[0])){
k++;
break;
}
}
}
l[m-1] = 0;
for(; k<n; k++)
l[m-1] += b[k];
hk[mp++] = max();
}
}
int min(){
int tmp = hk[0];
map<int, int>::iterator it = hk.begin();
while(it!=hk.end()){
if(tmp > (*it).second)
tmp = (*it).second;
it++;
}
return tmp;
}
int main(){
while(true){
cin >> m >> n;
if(!m && !n)
return 0;
b = new int[n];
l = new int[m];
for(int i=0; i< n; i++)
cin >> b[i];
solve();
cout << min() << endl;
delete[] b;
delete[] l;
hk.clear();
}
} | a.cc: In function 'void solve()':
a.cc:31:91: error: expected ')' before ';' token
31 | if((l[0] - l[j] >= 0 && l[0] - l[j] < l[j] + b[k+1] - l[0];)||(l[j] >= l[0])){
| ~ ^
| )
a.cc:31:91: error: expected ')' before ';' token
31 | if((l[0] - l[j] >= 0 && l[0] - l[j] < l[j] + b[k+1] - l[0];)||(l[j] >= l[0])){
| ~ ^
| )
a.cc:31:92: error: expected primary-expression before ')' token
31 | if((l[0] - l[j] >= 0 && l[0] - l[j] < l[j] + b[k+1] - l[0];)||(l[j] >= l[0])){
| ^
|
s143524217 | p00181 | C++ | #include <iostream>
#include <map>
using namespace std;
int m,n,*b,*l,mp;
map<int,int> hk;
int max(){
int tmp = l[0];
for(int i=1; i<m; i++)
if(tmp < l[i])
tmp = l[i];
return tmp;
}
void erase(){
for(int i=1; i<m; i++)
l[i] = 0;
}
void solve(int x, int y){
l[x] = 0;
for(int i=y; i<n; i++){
l[x] += b[i];
if(x != m-1)
solve(x+1, i+1);
}
if(x == m-1){
// for(int i=0; i<m; i++)
// cout << l[i] << ' ';
// cout << endl;
hk[mp++] = max();
if(hl[mp-1] < hk[mp])
goto FIN;
return;
}
}
int min(){
int tmp = hk[0];
map<int, int>::iterator it = hk.begin();
while(it!=hk.end()){
if(tmp > (*it).second)
tmp = (*it).second;
it++;
}
return tmp;
}
int main(){
while(true){
cin >> m >> n;
if(!m && !n)
return 0;
b = new int[n];
l = new int[m];
for(int i=0; i< n; i++)
cin >> b[i];
mp = 0;
solve(0, 0);
FIN:;
cout << min() << endl;
delete[] b;
delete[] l;
hk.clear();
}
} | a.cc: In function 'void solve(int, int)':
a.cc:33:20: error: 'hl' was not declared in this scope; did you mean 'l'?
33 | if(hl[mp-1] < hk[mp])
| ^~
| l
a.cc:34:30: error: label 'FIN' used but not defined
34 | goto FIN;
| ^~~
|
s809626742 | p00181 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int n, m;
int data[100];
int mid, l, r;
bool check(){
int w = 0;
for(int i=0;i<m;i++){
int sum = 0;
for(;w<n;w++){
if(sum + data[w] > mid) break;
sum += data[w];
}
if(w>=n) break;
}
if(w >= n) return true;
return false;
}
main(){
while(cin >> m >> n && (n || m)){
for(int i=0;i<n;i++){
cin >> data[i];
}
l = 0;
r = 1500000;
while(abs(r-l) > 1){
mid = (l+r)/2;
if(check()){
r = mid;
}else{
l = mid;
}
}
cout << r << endl;
}
return 0;
} | a.cc: In function 'bool check()':
a.cc:15:19: error: reference to 'data' is ambiguous
15 | if(sum + data[w] > mid) break;
| ^~~~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:5: note: 'int data [100]'
7 | int data[100];
| ^~~~
a.cc:16:17: error: reference to 'data' is ambiguous
16 | sum += data[w];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:5: note: 'int data [100]'
7 | int data[100];
| ^~~~
a.cc: At global scope:
a.cc:24:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
24 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:27:17: error: reference to 'data' is ambiguous
27 | cin >> data[i];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:5: note: 'int data [100]'
7 | int data[100];
| ^~~~
|
s823279111 | p00181 | C++ | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
int height(const vint& v, int w)
{
int res = 0, pl = 0;
rep(i, v.size())
{
if(w < pl + v[i])
{
res++;
if(w < v[i]) return INT_MAX;
pl = 0;
}
pl += v[i];
}
return res + (pl != 0);
}
int main()
{
int m, n;
while(cin >> m >> n && n)
{
vint v(n);
rep(i, n) cin >> v[i];
double lb = 1, ub = 1500000;
rep(i, 10000)
{
double mid = (ub + lb) / 2;
if(height(v, ceil(mid)) <= m) ub = mid;
else lb = mid;
}
cout << ceil(ub) << endl;
}
} | a.cc: In function 'int height(const vint&, int)':
a.cc:48:45: error: 'INT_MAX' was not declared in this scope
48 | if(w < v[i]) return INT_MAX;
| ^~~~~~~
a.cc:24:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
23 | #include <fstream>
+++ |+#include <climits>
24 | using namespace std;
|
s793986283 | p00181 | C++ |
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }
int height(vint& v, int w)
{
int res = 0, pl = 0;
rep(i, v.size())
{
if(w < pl + v[i])
{
res++;
if(w < v[i]) return INT_MAX;
pl = 0;
}
pl += v[i];
}
return res + (pl != 0);
}
int main()
{
int m, n;
while(cin >> m >> n && n)
{
vint v(n);
rep(i, n) cin >> v[i];
double lb = 1, ub = 1500000;
rep(i, 10000)
{
double mid = (ub + lb) / 2;
if(height(v, ceil(mid)) <= m) ub = mid;
else lb = mid;
}
cout << ceil(ub) << endl;
}
} | a.cc: In function 'int height(vint&, int)':
a.cc:49:45: error: 'INT_MAX' was not declared in this scope
49 | if(w < v[i]) return INT_MAX;
| ^~~~~~~
a.cc:25:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
24 | #include <fstream>
+++ |+#include <climits>
25 | using namespace std;
|
s892883746 | p00181 | C++ | #include<iostream>
using namespace std;
int m, n;
hon[100];
int f(int w) {
int honIdx = 0;
for (int i = 0; i < m; i++) {
int curW = w;
while (hon[honIdx] <= curW) {
curW -= hon[honIdx];
honIdx++;
if (honIdx == n) return 1;
}
}
return 0;
}
int binsearch_lower_bound() {
int low = 0; // 範囲の下限
int high = 1000000 + 1; // 範囲の上限。解はあれば [low, high] の中に存在する
while (low < high) {
int mid = (low + high) / 2; // 中心点(この実装ではオーバーフローしうるので注意)
int midval = f(mid); // 中心での値
// 解の範囲を狭める
if (midval < 1) low = mid + 1;
else high = mid;
}
return low;
}
int main() {
while(cin >> m >> n, m || n) {
for (int i = 0; i < n; i++) {
cin >> hon[i];
}
cout << binsearch_lower_bound() << endl;
}
return 0;
} | a.cc:6:1: error: 'hon' does not name a type
6 | hon[100];
| ^~~
a.cc: In function 'int f(int)':
a.cc:12:24: error: 'hon' was not declared in this scope
12 | while (hon[honIdx] <= curW) {
| ^~~
a.cc: In function 'int main()':
a.cc:38:32: error: 'hon' was not declared in this scope
38 | cin >> hon[i];
| ^~~
|
s356801298 | p00182 | Java | import java.util.Arrays;
import java.util.Scanner;
//Beaker
public class Main {
int n;
int[] a;
boolean[] have, t;
boolean dfs(int k, int rest){
if(rest==0){
for(int i=0;i<n;i++)t[i]=have[i];
return greedy();
}
if(rest < a[k])return false;
have[k] = true;
if(dfs(k+1, rest-a[k]))return true;
have[k] = false;
return dfs(k+1, rest);
}
boolean choice(int k, int rest){
if(rest==0)return true;
if(k<0)return false;
if(!t[k])return choice(k-1, rest);
if(a[k]<=rest){
t[k] = false;
if(choice(k-1, rest-a[k]))return true;
t[k] = true;
}
return choice(k-1, rest);
}
boolean greedy(){
for(int i=0;i<n;i++)if(!t[i]){
if(!choice(i-1, a[i]))return false;
t[i] = true;
}
return true;
}
void run(){
Scanner sc = new Scanner(System.in);
t = new boolean[100];
have = new boolean[100];
for(;;){
n = sc.nextInt();
if(n==0)break;
a = new int[n];
for(int i=0;i<n;i++){
a[i] = sc.nextInt();
}
Arrays.sort(a);
Arrays.fill(have, false);
have[0] = true;
System.out.println(dfs(1, a[n-1]-a[0])?"YES":"NO");
}
}
public static void main(String[] args) {
new AOJ0182().run();
}
} | Main.java:62: error: cannot find symbol
new AOJ0182().run();
^
symbol: class AOJ0182
location: class Main
1 error
|
s116700314 | p00182 | C++ | #include<iostream>
#include<vector>
#include<bitset>
#include<set>
#include<tuple>
#include<algorithm>
#include<functional>
using namespace std;
const int N = 50;
int n;
vector<int> beaker;
bitset<N> full;
bitset<N> used;
bool pour(int water, int start);
bool check();
bool pour(int water, int start) {
for(int i = start; i < n; ++i) {
if(full[i] || used[i]) continue;
if(water < beaker[i]) continue;
else if(water == beaker[i]) {
full.set(i);
used.set(i);
if(check()) return true;
full.reset(i);
used.reset(i);
} else {
full.set(i);
used.set(i);
if(pour(water - beaker[i], i + 1)) return true;
full.reset(i);
used.reset(i);
}
}
return false;
}
bool check() {
if(used.count() == n) return true;
for(int i = 0; i < n; ++i) {
if(!full[i]) continue;
full.reset(i);
if(pour(beaker[i], i + 1)) return true;
full.set(i);
}
return false;
}
int main() {
while(cin >> n, n) {
beaker.resize(n);
for(auto& b: beaker) cin >> b;
sort(beaker.begin(), beaker.end(), greater<int>());
full = bitset<N>(1);
used = bitset<N>(1);
memo.clear();
cout << (check() ? "YES" : "NO") << endl;
}
} | a.cc: In function 'int main()':
a.cc:60:9: error: 'memo' was not declared in this scope
60 | memo.clear();
| ^~~~
|
s118507757 | p00182 | C++ | #include <iostream>
#include <vector>
using namespace std;
#define FREE 0
#define TRIED 1
#define LOCKED 2
#define DONE 3
//0182
int main(){
int n,x;
while(cin >> n, n){
vector<int> v1;
int capacity=0;
char used[10]={0}; //0:free 1:tried 2:locked 3:done
//char *used = new char[n];
for(int i=0; i<n; ++i){
cin >> x;
capacity+=x;
v1.push_back(x);
}
sort(v1.begin(),v1.end(), greater<int>());
//int target=v1[0];
used[0]=LOCKED;
//capacity-=v1[0];
int temp_capacity = capacity;
bool isCancel=true;
bool isComplete=true;
for(int i=0; i<n; ++i){
if(used[i]!=LOCKED){
continue;
}
if(n==1){
used[0]=DONE;
break;
}
int temp_target=v1[i];
for(int i=0; i<n; ++i){
if(used[i]!=FREE){
continue;
}
if(temp_target>=v1[i]){
used[i]=TRIED;
capacity-=v1[i];
temp_target-=v1[i];
temp_capacity-=v1[i];
}
}
if(temp_target==0){
isCancel = false;
}
for(int i=0; i<n; ++i){
if(isCancel){
if(used[i]==TRIED){
used[i]=FREE;
temp_capacity+=v1[i];
}
}else{
if(used[i]==LOCKED){
used[i]=DONE;
}
if(used[i]==TRIED){
used[i]=LOCKED;
}
}
}
}
for(int i=0; i<n; ++i){
if(used[i]!=DONE)
isComplete=false;
}
cout << (isComplete ? "YES" : "NO") << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:17: error: 'sort' was not declared in this scope; did you mean 'short'?
25 | sort(v1.begin(),v1.end(), greater<int>());
| ^~~~
| short
|
s274215989 | p00182 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>
#include <cstdlib>
#include <numeric>
#include <queue>
using namespace std;
#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
int n;
int C[50];
bool used[50];
bool full[50];
bool searchFrom();
bool searchTo(int v, int src)
{
reps(i, src+1, n){
if(!used[i]){
full[i] = used[i] = true;
if(C[i] == v){
if(searchFrom())
return true;
}
else if(C[i] < v && searchTo(v-C[i], i))
return true;
full[i] = used[i] = false;
}
}
return false;
}
bool searchFrom()
{
int unused = -1;
rep(i, n){
if(!used[i]){
unused = i;
break;
}
}
if(unused == -1)
return true;
rep(i, unused){
if(full[i]){
full[i] = false;
if(searchTo(C[i], i))
return true;
full[i] = true;
}
}
return false;
}
int main()
{
while(scanf("%d", &n), n){
rep(i, n)
scanf("%d", &C[i]);
rep(i, 101)
visited[i].clear();
sort(C, C+n, greater<int>());
fill(used, used+n, false);
fill(full, full+n, false);
used[0] = full[0] = true;
puts(searchFrom() ? "YES" : "NO");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:83:25: error: 'visited' was not declared in this scope
83 | visited[i].clear();
| ^~~~~~~
|
s554815866 | p00182 | C++ | #include<cstdio>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
bool dfs(int i);
int n,a[50];
bool vis[50],fil[50];
bool dfs2(int i,int j,int rem){ // partition
if(rem==0) return dfs(i+1);
if(j==n) return false;
if(!vis[j] && a[j]<=rem){
vis[j]=fil[j]=true;
if(dfs2(i,j+1,rem-a[j])) return true;
vis[j]=fil[j]=false;
}
return dfs2(i,j+1,rem);
}
bool dfs(int i){
if(i==n) return true;
if(!vis[i]) return false;
if(dfs(i+1)) return true;
if(fil[i]){
fil[i]=false;
if(dfs2(i,i+1,a[i])) return true;
fil[i]=true;
}
return false;
}
int main(){
for(;scanf("%d",&n),n;){
rep(i,n){
scanf("%d",a+i);
vis[i]=fil[i]=false;
}
sort(a,a+n,greater<int>());
vis[0]=fil[0]=true;
puts(dfs(0)?"YES":"NO");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:46:28: error: 'greater' was not declared in this scope
46 | sort(a,a+n,greater<int>());
| ^~~~~~~
a.cc:46:36: error: expected primary-expression before 'int'
46 | sort(a,a+n,greater<int>());
| ^~~
|
s554555181 | p00182 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <time.h>
#include <cstdio>
using namespace std;
clock_t start, end;
vector<int> v;
int dn[100]={};
int dfs(int x,int r){
end=clock();
if( (double)(end - start) > 0.1 * CLOCKS_PER_SEC ){
return 0;
}
if( !dn[x] ) return 0;
if( r < 0 ) return 0;
if( r == 0 ){
return dfs(x+1,v[x+1]);
}
if( x == v.size()-1 ) return r != 0;
if( r == v[x] ){
if( dfs(x+1,v[x+1]) ) return 1;
}
long long can[2] = {} , tmp[2] = {};
can[0] |= 1;
// branch-cutting
for(int i = x + 1 ; i < v.size() ; i++){
if( !dn[i] ){
if( v[x] < 64 ){
tmp[0] = can[0] << v[x];
tmp[1] = (can[0] >> (64-v[x])) | (can[1] << v[x]);
}else{
tmp[0] = 0;
tmp[1] = can[0] << (v[x]-64);
}
can[0] |= tmp[0];
can[1] |= tmp[1];
}
}
if( !(can[v[x]/64]>>(v[x]%64)&1) ){
return 0;
}
for(int i = x + 1 ; i < v.size() ; i++){
if( dn[i] == 0 ){
dn[i] = 1;
if( dfs(x,r-v[i]) ) return 1;
dn[i] = 0;
}
}
return 0;
}
int main(){
int n;
while(cin >> n && n){
v.resize(n);
for(int i = 0 ; i < n ; i++) dn[i] = 0;
//for(int i = 0 ; i < n ; i++) v[i] = rand() % 100 + 1;
for(int i = 0 ; i < n ; i++) cin >> v[i];
sort(v.rbegin(),v.rend());
dn[0] = 1;
start=clock();
cout << (dfs(0,v[0])?"YES":"NO") << endl;
dn[1] = 0;
}
} | a.cc: In function 'int dfs(int, int)':
a.cc:13:9: error: reference to 'end' is ambiguous
13 | end=clock();
| ^~~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
In file included from /usr/include/c++/14/bits/range_access.h:36:
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:7:16: note: 'clock_t end'
7 | clock_t start, end;
| ^~~
a.cc:14:22: error: reference to 'end' is ambiguous
14 | if( (double)(end - start) > 0.1 * CLOCKS_PER_SEC ){
| ^~~
/usr/include/c++/14/bits/range_access.h:116:37: note: candidates are: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:115:31: note: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
115 | template<typename _Tp> _Tp* end(valarray<_Tp>&) noexcept;
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
a.cc:7:16: note: 'clock_t end'
7 | clock_t start, end;
| ^~~
|
s096213558 | p00183 | C | #include<stdio.h>
int main(){
int b[3][3];
int i,j;
while(1){
for(i=0;i<3;i++){
for(j=0;j<3;j++){
scanf("%d",&b[i][j]);
if(board[i][j]==0)return 0;
}
}
if(b[0][0]==b[0][1]&&b[0][1]==b[0][2]&&b[0][2]==b[0][0]){
if(!(b[0][0]=='+')){
printf("%c\n",b[0][0]);
continue;
}
}
if(b[1][0]==b[1][1]&&b[1][1]==b[1][2]&&b[1][2]==b[1][0]){
if(!(b[1][0]=='+')){
printf("%c\n",b[1][0]);
continue;
}
}
if(b[2][0]==b[2][1]&&b[2][1]==b[2][2]&&b[2][2]==b[2][0]){
if(!(b[2][0]=='+')){
printf("%c\n",b[2][0]);
continue;
}
}
if(b[0][0]==b[1][0]&&b[1][0]==b[2][0]&&b[2][0]==b[0][0]){
if(!(b[0][0]=='+')){
printf("%c\n",b[0][0]);
continue;
}
}
if(b[0][1]==b[1][1]&&b[1][1]==b[2][1]&&b[2][1]==b[0][1]){
if(!(b[0][1]=='+')){
printf("%c\n",b[0][1]);
continue;
}
}
if(b[0][2]==b[1][2]&&b[1][2]==b[2][2]&&b[2][2]==b[0][2]){
if(!(b[0][2]=='+')){
printf("%c\n",b[0][2]);
continue;
}
}
if(b[0][0]==b[1][1]&&b[1][1]==b[2][2]&&b[2][2]==b[0][0]){
if(!(b[0][0]=='+')){
printf("%c\n",b[0][0]);
continue;
}
}
if(b[2][0]==b[1][1]&&b[1][1]==b[0][2]&&b[0][2]==b[2][0]){
if(!(b[2][0]=='+')){
printf("%c\n",b[2][0]);
continue;
}
}
}
return 0;
} | main.c: In function 'main':
main.c:11:20: error: 'board' undeclared (first use in this function)
11 | if(board[i][j]==0)return 0;
| ^~~~~
main.c:11:20: note: each undeclared identifier is reported only once for each function it appears in
|
s931247699 | p00183 | C | #include <stdio.h>
int main(void) {
char input[3][4];
int win;
while(1) {
gets(input[0]);
if(input[0][0]=='0')break;
gets(input[1]);
gets(input[2]);
win=0;
for(i=0;i<3;i++) {
if(input[i][0]==input[i][1] &&
input[i][1]==input[i][2] &&
input[i][0]!='+') {
printf("%c\n",input[i][0]);
win=1;
break;
}
if(input[0][i]==input[1][i] &&
input[1][i]==input[2][i] &&
input[0][i]!='+') {
printf("%c\n",input[0][i]);
win=1;
break;
}
}
if(!win) {
if(input[0][0]==input[1][1] &&
input[1][1]==input[2][2] &&
input[0][0]!='+')printf("%c\n",input[0][0]);
else if(input[0][2]==input[1][1] &&
input[1][1]==input[2][0] &&
input[0][2]!='+')printf("%c\n",input[0][2]);
else puts("NA");
}
}
return 0;
} | main.c: In function 'main':
main.c:7:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
7 | gets(input[0]);
| ^~~~
| fgets
main.c:12:21: error: 'i' undeclared (first use in this function)
12 | for(i=0;i<3;i++) {
| ^
main.c:12:21: note: each undeclared identifier is reported only once for each function it appears in
|
s963342297 | p00183 | C | #include <stdio.h>
int main(void) {
char input[3][4];
int win;
int i;
while(1) {
gets(input[0]);
if(input[0][0]=='0')break;
gets(input[1]);
gets(input[2]);
win=0;
for(i=0;i<3;i++) {
if(input[i][0]==input[i][1] &&
input[i][1]==input[i][2] &&
input[i][0]!='+') {
printf("%c\n",input[i][0]);
win=1;
break;
}
if(input[0][i]==input[1][i] &&
input[1][i]==input[2][i] &&
input[0][i]!='+') {
printf("%c\n",input[0][i]);
win=1;
break;
}
}
if(!win) {
if(input[0][0]==input[1][1] &&
input[1][1]==input[2][2] &&
input[0][0]!='+')printf("%c\n",input[0][0]);
else if(input[0][2]==input[1][1] &&
input[1][1]==input[2][0] &&
input[0][2]!='+')printf("%c\n",input[0][2]);
else puts("NA");
}
}
return 0;
} | main.c: In function 'main':
main.c:8:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
8 | gets(input[0]);
| ^~~~
| fgets
|
s378880373 | p00183 | C | #include <stdio.h>
int main(void) {
char input[3][12];
int win;
int i;
while(1) {
fgets(input[0],sizeof(input[0],stdin);
if(input[0][0]=='0')break;
fgets(input[1],sizeof(input[1],stdin);
fgets(input[2],sizeof(input[2],stdin);
win=0;
for(i=0;i<3;i++) {
if(input[i][0]==input[i][1] &&
input[i][1]==input[i][2] &&
input[i][0]!='+') {
printf("%c\n",input[i][0]);
win=1;
break;
}
if(input[0][i]==input[1][i] &&
input[1][i]==input[2][i] &&
input[0][i]!='+') {
printf("%c\n",input[0][i]);
win=1;
break;
}
}
if(!win) {
if(input[0][0]==input[1][1] &&
input[1][1]==input[2][2] &&
input[0][0]!='+')printf("%c\n",input[0][0]);
else if(input[0][2]==input[1][1] &&
input[1][1]==input[2][0] &&
input[0][2]!='+')printf("%c\n",input[0][2]);
else puts("NA");
}
}
return 0;
} | main.c: In function 'main':
main.c:8:54: error: expected ')' before ';' token
8 | fgets(input[0],sizeof(input[0],stdin);
| ~ ^
| )
main.c:8:17: error: too few arguments to function 'fgets'
8 | fgets(input[0],sizeof(input[0],stdin);
| ^~~~~
In file included from main.c:1:
/usr/include/stdio.h:654:14: note: declared here
654 | extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
| ^~~~~
main.c:40:1: error: expected declaration or statement at end of input
40 | }
| ^
main.c:40:1: error: expected declaration or statement at end of input
|
s923620955 | p00183 | C++ | #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
char in[3][4];
while(cin>>in[0],in[0][0]!='0'){
rep(i,2)cin>>in[i+1];
bool h=false;
rep(i,3){
if(in[0][i]==in[1][i]&&in[1][i]==in[2][i]&&in[0][i]!='+'){cout<<in[0][i]<<endl;h=true;break;}
else if(in[i][0]==in[i][1]&&in[i][1]==in[i][2]&&in[i][0]!='+'){cout<<in[i][0]<<endl;h=true;break}
}
if(!h){
if(in[0][0]==in[1][1]&&in[1][1]==in[2][2]&&in[0][0]!='+')cout<<in[0][0]<<endl;
else if(in[2][0]==in[1][1]&&in[1][1]==in[0][2]&&in[1][1]!='+')cout<<in[1][1]<<endl;
else cout<<"NA"<<endl;
}
}
} | a.cc: In function 'int main()':
a.cc:26:103: error: expected ';' before '}' token
26 | else if(in[i][0]==in[i][1]&&in[i][1]==in[i][2]&&in[i][0]!='+'){cout<<in[i][0]<<endl;h=true;break}
| ^
| ;
|
s133557749 | p00183 | C++ | #include<iostream>
#include<cmath>
#include<vector>
#include<string>
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<a;i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const double eps = 1e-10;
const double pi = acos(-1);
const double inf = (int)1e8;
int main(void){
char maze[3][3];
while(cin>>mazze[0][0]){
if(maze[0][0] == '0')break;
rep(i,3)rep(j,3){
if(i==0&&j==0)continue;
cin>>maze[i][j];
}
bool find = false;
rep(i,3)if(maze[0][i] == maze[1][i] &&
maze[1][i] == maze[2][i] &&
maze[0][i] != '+'){
cout<<maze[0][i]<<endl;
find = true;
}
if(find)continue;
rep(i,3)if(maze[i][0] == maze[1][i] &&
maze[i][1] == maze[2][i] &&
maze[i][2] != '+'){
cout<<maze[i][1]<<endl;
find = true;
}
if(find)continue;
if(maze[0][0] == maze[1][1] &&
maze[1][1] == maze[2][2] &&
maze[1][1] != '+'){
cout<<maze[0][0]<<endl;
continue;
}else if(maze[2][0] == maze[1][1] &&
maze[1][1] == maze[0][2] &&
maze[2][0] != '+'){
cout<<maze[1][1]<<endl;
continue;
}else{
cout<<"NA"<<endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:14: error: 'mazze' was not declared in this scope; did you mean 'maze'?
15 | while(cin>>mazze[0][0]){
| ^~~~~
| maze
|
s206248477 | p00183 | C++ | include <bits/stdc++.h>
using namespace std;
int main()
{
string str1, str2, str3;
while (cin >> str1, str1 != "0"){
bool b, w;
b = w = false;
cin >> str2 >> str3;
if (str1[0] == str1[1] && str1[0] == str1[2]){
if (str1[0] == 'b') b = true;
if (str1[0] == 'w') w = true;
}
else if (str2[0] == str2[1] && str2[0] == str2[2]){
if (str2[0] == 'b') b = true;
if (str2[0] == 'w') w = true;
}
else if (str3[0] == str3[1] && str3[0] == str3[2]){
if (str3[0] == 'b') b = true;
if (str3[0] == 'w') w = true;
}
else if (str1[0] == str2[0] && str1[0] == str3[0]){
if (str1[0] == 'b') b = true;
if (str1[0] == 'w') w = true;
}
else if (str1[1] == str2[1] && str1[1] == str3[1]){
if (str1[1] == 'b') b = true;
if (str1[1] == 'w') w = true;
}
else if (str1[2] == str2[2] && str1[2] == str3[2]){
if (str1[2] == 'b') b = true;
if (str1[2] == 'w') w = true;
}
else if (str1[0] == str2[1] && str1[0] == str3[2]){
if (str1[0] == 'b') b = true;
if (str1[0] == 'w') w = true;
}
else if (str1[2] == str2[1] && str1[2] == str3[0]){
if (str1[2] == 'b') b = true;
if (str1[2] == 'w') w = true;
}
if (b) cout << 'b';
if (w) cout << 'w';
if (!b && !w)cout << "NA";
cout << endl;
}
}
| a.cc:1:1: error: 'include' does not name a type
1 | include <bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
6 | string str1, str2, str3;
| ^~~~~~
a.cc:7:10: error: 'cin' was not declared in this scope
7 | while (cin >> str1, str1 != "0"){
| ^~~
a.cc:7:17: error: 'str1' was not declared in this scope
7 | while (cin >> str1, str1 != "0"){
| ^~~~
a.cc:10:12: error: 'str2' was not declared in this scope
10 | cin >> str2 >> str3;
| ^~~~
a.cc:10:20: error: 'str3' was not declared in this scope
10 | cin >> str2 >> str3;
| ^~~~
a.cc:45:13: error: 'cout' was not declared in this scope
45 | if (b) cout << 'b';
| ^~~~
a.cc:46:12: error: 'cout' was not declared in this scope
46 | if (w) cout << 'w';
| ^~~~
a.cc:47:18: error: 'cout' was not declared in this scope
47 | if (!b && !w)cout << "NA";
| ^~~~
a.cc:48:5: error: 'cout' was not declared in this scope
48 | cout << endl;
| ^~~~
a.cc:48:13: error: 'endl' was not declared in this scope
48 | cout << endl;
| ^~~~
|
s748066461 | p00183 | C++ | #include <cstdio>
#include <string>
using namespace std;
int main(void)
{
string board[3];
string set[2];
string y_comp;
string t_comp;
string l_comp;
string r_comp;
char str[4];
bool flag = false;
set[0] = "bbb";
set[1] = "www";
while (1){
for (int i = 0; i < 3; i++){
scanf("%s", str);
if (str[0] == '0') {
flag = true;
break;
}
board[i] = str;
}
if (flag) break;
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
y_comp += board[i][j];
t_comp += board[j][i];
if (i + j == 2) l_comp += board[i][j];
}
if (y_comp == set[0] || t_comp == set[0]) printf("b\n");
else if (y_comp == set[1] || t_comp == set[1]) printf("w\n");
else puts("NA");
y_comp.clear();
t_comp.clear();
r_comp += board[i][i];
}
if (r_comp == set[0] || l_comp == set[0]) printf("b\n");
else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
puts("NA");
}
return (0);
} | a.cc: In function 'int main()':
a.cc:45:53: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ~~~~~~ ^~ ~~~~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/bits/char_traits.h:42,
from /usr/include/c++/14/string:42,
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:45:61: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
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 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:45:61: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
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:45:61: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
/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:45:61: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
/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:45:61: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
/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:45:61: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
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:45:61: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
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:45:61: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
/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:45:61: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
/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:45:61: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'char'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
/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:45:61: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'char'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
/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:45:61: note: mismatched types 'const _CharT*' and 'char'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:45:61: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>'
45 | else if (r_comp == set[1] || l_comp == str[1]) printf("w\n");
| ^
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:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:45:61: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} i |
s069166888 | p00183 | C++ | bbw
wbw
+b+
bwb
wbw
wbw
0 | a.cc:1:1: error: 'bbw' does not name a type
1 | bbw
| ^~~
|
s189962266 | p00184 | C | #include <stdio.h>
int sum[7];
int main(void)
{
int i, j, n, g;
while (scanf("%d", &n), n != 0){
for (j = 0; j < n; j++){
sacnf("%d", &g);
if (G / 10 > 6){
sum[6]++;
}
else {
sum[g / 10]++;
}
}
for (i = 0; i < 7; i++){
printf("%d\n", sum[i]);
sum[i] = 0;
}
}
return 0;
} | main.c: In function 'main':
main.c:10:25: error: implicit declaration of function 'sacnf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
10 | sacnf("%d", &g);
| ^~~~~
| scanf
main.c:11:29: error: 'G' undeclared (first use in this function)
11 | if (G / 10 > 6){
| ^
main.c:11:29: note: each undeclared identifier is reported only once for each function it appears in
|
s071880892 | p00184 | C | #include <stdio.h>
int sum[7];
int main(void)
{
int i, j, n, g;
while (scanf("%d", &n), n != 0){
for (j = 0; j < n; j++){
sacnf("%d", &g);
if (g / 10 > 6){
sum[6]++;
}
else {
sum[g / 10]++;
}
}
for (i = 0; i < 7; i++){
printf("%d\n", sum[i]);
sum[i] = 0;
}
}
return 0;
} | main.c: In function 'main':
main.c:10:25: error: implicit declaration of function 'sacnf'; did you mean 'scanf'? [-Wimplicit-function-declaration]
10 | sacnf("%d", &g);
| ^~~~~
| scanf
|
s659650601 | p00184 | C | #include <stdio.h>
int main(void)
{
int n,i;
int sum=0,a;
int b[11]={0};
while(scanf("%d",&n)&&n!=0){
for(i=0;i<n;i++){
scanf("%d",&a);
b[a%10]++;
}
b[6]=b[6]+b[7]+b[8]+b[9]+b[10];
printf("%d\n",n);
for(i=0;i<7;i++){
printf("%d\n",b[i]);
}
return 0 ;
} | main.c: In function 'main':
main.c:20:1: error: expected declaration or statement at end of input
20 | }
| ^
|
s009956531 | p00184 | C | #include <stdio.h>
int main(void)
{
int n,i;
int sum=0,a;
int b[11]={0};
while(scanf("%d",&n)&&n!=0){
for(i=0;i<n;i++){
scanf("%d",&a);
if(a<60)
b[a%10]++;
else
b[6]++;
}
b[6]=b[6]+b[7]+b[8]+b[9]+b[10];
printf("%d\n",n);
for(i=0;i<7;i++){
printf("%d\n",b[i]);
}
return 0 ;
} | main.c: In function 'main':
main.c:23:1: error: expected declaration or statement at end of input
23 | }
| ^
|
s970820856 | p00184 | C | #include <stdio.h>
int main(void)
{
int n, a, c1, c2, c3, c4, c5, c6, c7;
scanf("%d", &n);
c1 = c2 = c3 = c4 = c5 = c6 = c7 = 0;
while (n--){
scanf("%d", &a);
if (a < 10){
c1++;
}0
else if (a < 20){
c2++;
}
else if (a < 30){
c3++;
}
else if (a < 40){
c4++;
}
else if (a < 50){
c5++;
}
else if (a < 60){
c6++;
}
else {
c7++;
}
}
printf("%d\n%d\n%d\n%d\n%d\n%d\n%d", c1, c2, c3, c4, c5, c6, c7);
return (0);
} | main.c: In function 'main':
main.c:15:19: error: expected ';' before 'else'
15 | }0
| ^
| ;
16 | else if (a < 20){
| ~~~~
|
s454193980 | p00184 | C | #include <stdio.h>
int main(void)
{
int n;
int age;
int a_g[7] = {0};
int i;
while (1) {
scanf("%d", &n);
if (n == 0) {
break;
}
else {
for (i = 0; i < n; i++) {
scanf("%d", &age);
if ((age >= 0) && (age <= 9)) {
a_g[0]++;
}
else if ((age >= 10) && (age <= 19)) {
a_g[1]++;
}
else if ((age >= 20) && (age <= 29)) {
a_g[2]++;
}
else if ((age >= 30) && (age <= 39)) {
a_g[3]++;
}
else if ((age >= 40) && (age <= 49)) {
a_g[4]++;
}
else if ((age >= 50) && (age <= 59)) {
a_g[5]++;
}
else if (age >= 60) {
a_g[6]++;
}
}
}
printf("%d\n", a_g[0]);
printf("%d\n", a_g[1]);
printf("%d\n", a_g[2]);
printf("%d\n", a_g[3]);
printf("%d\n", a_g[4]);
printf("%d\n", a_g[5]);
printf("%d\n", a_g[6]);
age[7] = {0};
}
return (0);
} | main.c: In function 'main':
main.c:60:20: error: subscripted value is neither array nor pointer nor vector
60 | age[7] = {0};
| ^
main.c:60:26: error: expected expression before '{' token
60 | age[7] = {0};
| ^
|
s045367106 | p00184 | C | #include<stdio.h>
int main(void)
{
int dataset = 0;
int age;
int i;
int s;
int pnum[7];
scanf("%d",&dataset);
for(i = 0;i < dataset;i++)
{
scanf("%d",&age);
s = (age / 10);
punm[s]++;
}
for(i = 0;i < 7;i++)
{
printf("%d\n",punm[i]);
}
return 0;
} | main.c: In function 'main':
main.c:15:17: error: 'punm' undeclared (first use in this function); did you mean 'pnum'?
15 | punm[s]++;
| ^~~~
| pnum
main.c:15:17: note: each undeclared identifier is reported only once for each function it appears in
|
s672850690 | p00184 | C | #include<stdio.h>
int main(void)
{
int dataset = 0;
int age;
int i;
int s;
int pnum[7];
scanf("%d",&dataset);
for(i = 0;i < dataset;i++)
{
scanf("%d",&age);
s = (age / 10);
pnum[s]++;
}
for(i = 0;i < 7;i++)
{
printf("%d\n",punm[i]);
}
return 0;
} | main.c: In function 'main':
main.c:19:31: error: 'punm' undeclared (first use in this function); did you mean 'pnum'?
19 | printf("%d\n",punm[i]);
| ^~~~
| pnum
main.c:19:31: note: each undeclared identifier is reported only once for each function it appears in
|
s247751359 | p00184 | C | #include<stdio.h>
int main(void)
{
int dataset = 0;
int age;
int i;
int s;
int pnum[7] = 0;
scanf("%d",&dataset);
for(i = 0;i < dataset;i++)
{
scanf("%d",&age);
if(age >= 70)
{
age = 60;
}
s = (age / 10);
pnum[s]++;
}
for(i = 0;i < 7;i++)
{
printf("%d\n",pnum[i]);
}
return 0;
} | main.c: In function 'main':
main.c:9:23: error: invalid initializer
9 | int pnum[7] = 0;
| ^
|
s313307512 | p00184 | C | #include<stdio.h>
int main(){
int a[200000],b[7],i,j,c;
while(1){i=0;
b[0]=0;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=0;b[6]=0;
scanf("%d",&c);
if(c==0)break;
while(i-c<0){
scanf("%d",&a[i]);
if(a[i]>=0&&a[i]<10)b{0}++;
if(a[i]>=10&&a[i]<20)b[1]++;
if(a[i]>=20&&a[i]<30)b[2]++;
if(a[i]>=30&&a[i]<40)b[3]++;
if(a[i]>=40&&a[i]<50)b[4]++;
if(a[i]>=50&&a[i]<60)b[5]++;
if(a[i]>=60)b[6]++;
i++;
}
for(j=0;j<7;j++)
printf("%d",b[j]);
}
return 0;
} | main.c: In function 'main':
main.c:10:22: error: expected ';' before '{' token
10 | if(a[i]>=0&&a[i]<10)b{0}++;
| ^
| ;
|
s899743573 | p00184 | C | #include<stdio.h>
int main(){
int n,a[7];
while(scanf("%d",&n),n){
for(i=0;i<n;i++){
scanf("%d",&x);
if(x<10)
a[0]++;
else if(x<20)
a[1]++;
else if(x<30)
a[2]++;
else if(x<40)
a[3]++;
else if(x<50)
a[4]++;
else if(x<60)
a[5]++;
else a[6]++;
}
for(i=0;i<7;i++)
printf("%d\n",a[i]);
}
return 0;
} | main.c: In function 'main':
main.c:5:5: error: 'i' undeclared (first use in this function)
5 | for(i=0;i<n;i++){
| ^
main.c:5:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:13: error: 'x' undeclared (first use in this function)
6 | scanf("%d",&x);
| ^
|
s959688550 | p00184 | C | // include
// ----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>
// repetition
// ----------------------------------------------------------------------------
#define FOR(i, a, b) for (i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
// memory clear
// ----------------------------------------------------------------------------
#define CLRNUM(a) memset((a), 0, sizeof(a))
#define CLRBOOL(a, flag) memset((a), flag, sizeof(a))
#define CLRCHAR(a) memset((a), '\0', sizeof(a))
// debug
// ----------------------------------------------------------------------------
#define DEBUGINT(x) printf("%d\n", x);
#define DEBUGFLOAT(x) printf("%f\n", x);
#define DEBUGCHAR(x) printf("%c\n", x);
#define DEBUGSTR(x) printf("%s\n", x);
#define DEBUGFORINT(i, a, b, x) FOR(i, a, b){ printf("%d ", x[i]); }
#define DEBUGFORFLOAT(i, a, b,x ) FOR(i, a, b){ printf("%f ", x[i]); }
#define DEBUGFORCHAR(i, a, b, x) FOR(i, a, b){ printf("%c ", x[i]); }
#define DEBUGREPINT(i, n, x) REP(i, n){ printf("%d ", x[i]); }
#define DEBUGREPFLOAT(i, n, x) REP(i, n){ printf("%f ", x[i]); }
#define DEBUGREPCHAR(i, n, x) REP(i, n){ printf("%c ", x[i]); }
// other
// ----------------------------------------------------------------------------
#define PUTNL printf("\n")
// constant
// ----------------------------------------------------------------------------
#define INF 1000000000
int main(void)
{
long long int n;
int list[7];
int old;
int i;
while (1){
scanf("%lld", &n);
if (n == 0){
break;
}
CLRNUM(list);
for (i = 0; i < n; ++i){
scanf("%d", &old);
if (old < 10){
list[0]++;
}
else if (old > 9 && old < 20){
list[1]++;
}
else if (old > 19 && old < 30){
list[2]++;
}
else if (old > 29 && old < 40){
list[3]++;
}
else if (old > 39 && old < 50){
list[4]++;
}
else if (old > 49 && old < 60){
list[5]++;
}
else if (old > 59){
list[6]++;
}
}
for (i = 0; i < 7; ++i){
printf("%d\n", list[i]);
}
return 0;
} | main.c: In function 'main':
main.c:90:5: error: expected declaration or statement at end of input
90 | }
| ^
|
s413924107 | p00184 | C | #include<stdio.h>
int main(){
int i;
int n;
int old;
int und = 0;
int a[7] = 0, 0, 0, 0, 0, 0, 0;
while(n != 0){
scanf("%d", &n);
for(i = n + 1; i > 0; i--){
scanf("%d", &old);
if(old < 10){
a[0]++;
}else if(old < 20){
a[1]++;
}else if(old < 30){
a[2]++;
}else if(old < 40){
a[3]++;
}else if(old < 50){
a[4]++;
}else if(old < 60){
a[5]++;
}else{
a[6]++;
}
}
printf("%d\n", a[0]);
printf("%d\n", a[1]);
printf("%d\n", a[2]);
printf("%d\n", a[3]);
printf("%d\n", a[4]);
printf("%d\n", a[5]);
printf("%d\n", a[6]);
}
return 0;
} | main.c: In function 'main':
main.c:8:20: error: invalid initializer
8 | int a[7] = 0, 0, 0, 0, 0, 0, 0;
| ^
main.c:8:23: error: expected identifier or '(' before numeric constant
8 | int a[7] = 0, 0, 0, 0, 0, 0, 0;
| ^
|
s236720328 | p00184 | C | #include<stdio.h>
int main(){
int i;
int n;
int old;
int a = 0, 0, 0, 0, 0, 0, 0;
while(n != 0){
scanf("%d", &n);
for(i = n + 1; i > 0; i--){
scanf("%d", &old);
if(old < 10){
a[0]++;
}else if(old < 20){
a[1]++;
}else if(old < 30){
a[2]++;
}else if(old < 40){
a[3]++;
}else if(old < 50){
a[4]++;
}else if(old < 60){
a[5]++;
}else{
a[6]++;
}
}
printf("%d\n", a[0]);
printf("%d\n", a[1]);
printf("%d\n", a[2]);
printf("%d\n", a[3]);
printf("%d\n", a[4]);
printf("%d\n", a[5]);
printf("%d\n", a[6]);
}
return 0;
} | main.c: In function 'main':
main.c:7:20: error: expected identifier or '(' before numeric constant
7 | int a = 0, 0, 0, 0, 0, 0, 0;
| ^
main.c:14:42: error: subscripted value is neither array nor pointer nor vector
14 | a[0]++;
| ^
main.c:16:38: error: subscripted value is neither array nor pointer nor vector
16 | a[1]++;
| ^
main.c:18:38: error: subscripted value is neither array nor pointer nor vector
18 | a[2]++;
| ^
main.c:20:38: error: subscripted value is neither array nor pointer nor vector
20 | a[3]++;
| ^
main.c:22:38: error: subscripted value is neither array nor pointer nor vector
22 | a[4]++;
| ^
main.c:24:42: error: subscripted value is neither array nor pointer nor vector
24 | a[5]++;
| ^
main.c:26:34: error: subscripted value is neither array nor pointer nor vector
26 | a[6]++;
| ^
main.c:29:33: error: subscripted value is neither array nor pointer nor vector
29 | printf("%d\n", a[0]);
| ^
main.c:30:33: error: subscripted value is neither array nor pointer nor vector
30 | printf("%d\n", a[1]);
| ^
main.c:31:33: error: subscripted value is neither array nor pointer nor vector
31 | printf("%d\n", a[2]);
| ^
main.c:32:33: error: subscripted value is neither array nor pointer nor vector
32 | printf("%d\n", a[3]);
| ^
main.c:33:33: error: subscripted value is neither array nor pointer nor vector
33 | printf("%d\n", a[4]);
| ^
main.c:34:33: error: subscripted value is neither array nor pointer nor vector
34 | printf("%d\n", a[5]);
| ^
main.c:35:33: error: subscripted value is neither array nor pointer nor vector
35 | printf("%d\n", a[6]);
| ^
|
s772104061 | p00184 | C | #include<stdio.h>
int main(){
int i;
int n;
int old;
int a[7] = 0, 0, 0, 0, 0, 0, 0;
while(n != 0){
scanf("%d", &n);
for(i = n + 1; i > 0; i--){
scanf("%d", &old);
if(old < 10){
a[0]++;
}else if(old < 20){
a[1]++;
}else if(old < 30){
a[2]++;
}else if(old < 40){
a[3]++;
}else if(old < 50){
a[4]++;
}else if(old < 60){
a[5]++;
}else{
a[6]++;
}
}
printf("%d\n", a[0]);
printf("%d\n", a[1]);
printf("%d\n", a[2]);
printf("%d\n", a[3]);
printf("%d\n", a[4]);
printf("%d\n", a[5]);
printf("%d\n", a[6]);
}
return 0;
} | main.c: In function 'main':
main.c:7:20: error: invalid initializer
7 | int a[7] = 0, 0, 0, 0, 0, 0, 0;
| ^
main.c:7:23: error: expected identifier or '(' before numeric constant
7 | int a[7] = 0, 0, 0, 0, 0, 0, 0;
| ^
|
s933348007 | p00184 | C++ | #incude<stdio.h>
int main(){
int n[8]={};
int N,x;
while(1){
scanf("%d",&N);if(N==0)break;
for(int i=0;i<N;i++)
{
scanf("%d",&x);
if(x<10)n[0]++;
else if(x<20)n[1]++;
else if(x<30)n[2]++;
else if(x<40)n[3]++;
else if(x<50)n[4]++;
else if(x<60)n[5]++;
else if(x>=60)n[6]++;
}
for(int i=0;i<7;i++)
printf("%d\n",n[i]);
}
return 0;
} | a.cc:1:2: error: invalid preprocessing directive #incude; did you mean #include?
1 | #incude<stdio.h>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:8:1: error: 'scanf' was not declared in this scope
8 | scanf("%d",&N);if(N==0)break;
| ^~~~~
a.cc:22:1: error: 'printf' was not declared in this scope
22 | printf("%d\n",n[i]);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | #incude<stdio.h>
|
s749267846 | p00184 | C++ | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
using namespace std;
#define pb(n) push_back(n)
#define mk(n,m) make_pair(n,m)
#define fi first
#define se second
#define all(r) r.begin(),r.end()
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,a,b) for(int i=(a); i<=(b); i++)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-9;
//int mod=1000000007;
int main(){
int n;
int a;
while(cin>>n&&n>0){
vi v[7];
rep(i,n){
cin>>a;
int b=10;
for(int i=0; i<7; i++){
if(a<b){
v[i]++;
break;
}
b+=10;
}
}
for(int i=0; i<7; i++){
cout<<v[i]<<endl;
}
}
} | a.cc: In function 'int main()':
a.cc:47:45: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
47 | v[i]++;
| ~~~~^~
a.cc:54:29: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'vi' {aka 'std::vector<int>'})
54 | cout<<v[i]<<endl;
| ~~~~^~~~~~
| | |
| | vi {aka std::vector<int>}
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
243 | operator<<(long double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'long double'
243 | operator<<(long double __f)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
301 | operator<<(const void* __p)
| ^~~~~~~~
/usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'vi' {aka 'std::vector<int>'} to 'const void*'
301 | operator<<(const void* __p)
| ~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:306:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::nullptr_t) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; std::nullptr_t = std::nullp |
s439546162 | p00184 | C++ | using System;
class Program {
static void Main() {
for (string line; (line = Console.ReadLine()) != "0";) {
var n = int.Parse(line);
var ages = new int[7];
for (var i = 0; i < n; i++) {
var age = int.Parse(Console.ReadLine());
ages[age >= 60 ? 6 : (age / 10)] ++;
}
foreach (var count in ages) {
Console.WriteLine(count);
}
}
}
} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:19:2: error: expected ';' after class definition
19 | }
| ^
| ;
a.cc: In static member function 'static void Program::Main()':
a.cc:5:14: error: 'string' was not declared in this scope
5 | for (string line; (line = Console.ReadLine()) != "0";) {
| ^~~~~~
a.cc:5:28: error: 'line' was not declared in this scope
5 | for (string line; (line = Console.ReadLine()) != "0";) {
| ^~~~
a.cc:5:35: error: 'Console' was not declared in this scope
5 | for (string line; (line = Console.ReadLine()) != "0";) {
| ^~~~~~~
a.cc:6:13: error: 'var' was not declared in this scope
6 | var n = int.Parse(line);
| ^~~
a.cc:7:17: error: expected ';' before 'ages'
7 | var ages = new int[7];
| ^~~~
a.cc:9:22: error: expected ';' before 'i'
9 | for (var i = 0; i < n; i++) {
| ^
a.cc:9:29: error: 'i' was not declared in this scope
9 | for (var i = 0; i < n; i++) {
| ^
a.cc:9:33: error: 'n' was not declared in this scope
9 | for (var i = 0; i < n; i++) {
| ^
a.cc:10:21: error: expected ';' before 'age'
10 | var age = int.Parse(Console.ReadLine());
| ^~~
a.cc:11:17: error: 'ages' was not declared in this scope
11 | ages[age >= 60 ? 6 : (age / 10)] ++;
| ^~~~
a.cc:11:22: error: 'age' was not declared in this scope
11 | ages[age >= 60 ? 6 : (age / 10)] ++;
| ^~~
a.cc:14:26: error: expected ')' before 'count'
14 | foreach (var count in ages) {
| ^~~~~
a.cc:14:21: note: to match this '('
14 | foreach (var count in ages) {
| ^
a.cc:14:13: error: 'foreach' was not declared in this scope
14 | foreach (var count in ages) {
| ^~~~~~~
|
s288279419 | p00184 | C++ | #include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <stdlib.h>
using namespace std;
int main (void)
{
for (int u = 0; u < 100; u++)
{
long n;
cin >> n;
int a[10000],pp = 0;
for (long i = 0; i < n; i++)
{
cin >> a[i];
if (a[i] == 0)
{
pp = -1;
}
}
if (pp != 0)
{
break;
}
int o = 0,p = 0,q = 0,r = 0,s = 0,t = 0,u = 0;
for (long i = 0; i < n; i++)
{
if (a[i] < 10)
{
o++;
}
else if (a[i] < 20)
{
p++;
}
else if (a[i] < 30)
{
q++;
}
else if (a[i] < 40)
{
r++;
}
else if (a[i] < 50)
{
t++;
}
else
{
u++;
}
cout << o << endl << p << endl << q << endl << r << endl << s << endl << t << endl << u << endl ;
}
}
}
| a.cc: In function 'int main()':
a.cc:37:49: error: redeclaration of 'int u'
37 | int o = 0,p = 0,q = 0,r = 0,s = 0,t = 0,u = 0;
| ^
a.cc:17:18: note: 'int u' previously declared here
17 | for (int u = 0; u < 100; u++)
| ^
|
s301656832 | p00184 | C++ | #include<iostream>
int main() {
int am[7]={0,0,0,0,0,0,0};
int i,k;
while(1) {
std::cin>>i;
if(i==0)break;
for(int j=0;j<i;j++) {
std::cin>>k;
if(k>60)k=60;
am[k/10]++;
}
for(i=0;i<7;i++) std::coutam[i]<<"\n",am[i]=0;
}
} | a.cc: In function 'int main()':
a.cc:13:27: error: 'coutam' is not a member of 'std'; did you mean 'cout'?
13 | for(i=0;i<7;i++) std::coutam[i]<<"\n",am[i]=0;
| ^~~~~~
| cout
|
s664498267 | p00184 | C++ | #include <stdio.h>
int main(void)
{
int data[7] = {0};
int n;
int d;
scanf("%d", &n);
for (int i = 0; i < n; i++){
scanf("%d", &d);
if (d >= 60){
data[6]++;
}
else {
data[d / 10]++;
}
for (int i = 0; i < 7; i++){
printf("%d\n", data[i]);
}
return (0);
} | a.cc: In function 'int main()':
a.cc:26:2: error: expected '}' at end of input
26 | }
| ^
a.cc:4:1: note: to match this '{'
4 | {
| ^
|
s296341900 | p00184 | C++ | #include<iostream>
using namespace std;
int m,n;
int p[7]
int main(){
cin >> n;
if(!n)
return 0;
for(int i=0; i<7; i++)
p[i] = 0;
for(int i=0; i<n; i++){
cin >> m;
if(m>=70)
m = 60;
p[m%10]++;
}
for(int i=0; i<7; i++)
cout << p[i] << endl;
} | a.cc:7:1: error: expected initializer before 'int'
7 | int main(){
| ^~~
|
s906354809 | p00184 | C++ | while true do
n = gets.to_i
break if n == 0
people_num = [ 0, 0, 0, 0, 0, 0, 0, ]
n.times do
age = gets.to_i
if age < 10 then
people_num[0] += 1
elsif age < 20 then
people_num[1] += 1
elsif age < 30 then
people_num[2] += 1
elsif age < 40 then
people_num[3] += 1
elsif age < 50 then
people_num[4] += 1
elsif age < 60 then
people_num[5] += 1
else
people_num[6] += 1
end
end
people_num.each do |n|
puts n
end
end | a.cc:1:1: error: expected unqualified-id before 'while'
1 | while true do
| ^~~~~
|
s185035418 | p00184 | C++ | #include <iostream>
int main() {int n, x;while(std::cin>>n,n){int dat[7]={};for(int i=0;i<n;i++){cin>>x;if(x/10>6)x=60;dat[x/10]++;}for(int i=0;i<7;i++)std::cout<<dat[i]<<'\n';}} | a.cc: In function 'int main()':
a.cc:2:78: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
2 | int main() {int n, x;while(std::cin>>n,n){int dat[7]={};for(int i=0;i<n;i++){cin>>x;if(x/10>6)x=60;dat[x/10]++;}for(int i=0;i<7;i++)std::cout<<dat[i]<<'\n';}}
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s997639893 | p00185 | Java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] pri = new int[1000002];
for(int i=2;i<=1000000;i++){
pri[i] = i;
}
for(int i=2;i<=1000000;i++){
for(int j=i+i;j<=1000000;j+=i){
pri[j]=0;
}
}
while(true){
int n = sc.nextInt();
if(n==0)break;
int count=0;
for(int i=0;i<=n/2;i++){
if(pri[i]!=0 && pri[n-i]!=0)count++;
}
System.out.println(count);
}
}
| Main.java:30: error: reached end of file while parsing
}
^
1 error
|
s096138864 | p00185 | C | #include <stdio.h>
int a[1000000];
int ans[500]
int main(void)
{
int n, i, j, s = 0;
for (i = 1; i < 10000000; i++){
for (i = 2; i * j < 10000000; j++){
a[i * j] = 1;
}
}
while(scanf("%d", &n) != 0){
for (i = 1; i < 10000000; i++){
for(j = 10000000; j > 0; j--){
if (a[i] + a[j] == n){
ans[s]++;
}
}
}
s++;
}
for (i = 0; i =< s; i++){
printf("%d\n", ans[i]);
}
return (0);
} | main.c:4:13: error: expected ';' before 'int'
4 | int ans[500]
| ^
| ;
5 |
6 | int main(void)
| ~~~
main.c: In function 'main':
main.c:20:11: error: 'ans' undeclared (first use in this function)
20 | ans[s]++;
| ^~~
main.c:20:11: note: each undeclared identifier is reported only once for each function it appears in
main.c:27:18: error: expected expression before '<' token
27 | for (i = 0; i =< s; i++){
| ^
|
s767150501 | p00185 | C | ???#include<stdio.h>
#include<math.h>
int main(){
int n,p,q,i,j,count=0;
// FILE *fo;
// fo=fopen("data.txt","r");
// fscanf(fo,"%d",&n);
scanf("%d",&n);
while(n<>0){
for(p=1;p<=(n/2);p++){
q=n-p;
for(i=p/2;i>=2;i--)
if(p % i== 0)break;
if(i==1){
for(j=q/2;j>=2;j--)
if(q % j== 0)break;
if(j==1){
// printf("%d %d\n",p,q);
count++;
}
}
}
printf("%d\n",count);
scanf("%d",&n);
}
return 0;
} | main.c:1:1: error: expected identifier or '(' before '?' token
1 | ???#include<stdio.h>
| ^
main.c:1:4: error: stray '#' in program
1 | ???#include<stdio.h>
| ^
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
9 | scanf("%d",&n);
| ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
2 | #include<math.h>
+++ |+#include <stdio.h>
3 | int main(){
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
9 | scanf("%d",&n);
| ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:10:11: error: expected expression before '>' token
10 | while(n<>0){
| ^
main.c:26:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
26 | printf("%d\n",count);
| ^~~~~~
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s071864570 | p00185 | C | ???#include<stdio.h>
#include<math.h>
int main(){
int n,p,q,i,j,count=0;
// FILE *fo;
// fo=fopen("data.txt","r");
// fscanf(fo,"%d",&n);
scanf("%d",&n);
while(n<>0){
for(p=1;p<=(n/2);p++){
q=n-p;
for(i=p/2;i>=2;i--)
if(p % i== 0)break;
if(i==1){
for(j=q/2;j>=2;j--)
if(q % j== 0)break;
if(j==1){
// printf("%d %d\n",p,q);
count++;
}
}
}
printf("%d\n",count);
scanf("%d",&n);
}
return 0;
} | main.c:1:1: error: expected identifier or '(' before '?' token
1 | ???#include<stdio.h>
| ^
main.c:1:4: error: stray '#' in program
1 | ???#include<stdio.h>
| ^
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
9 | scanf("%d",&n);
| ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
2 | #include<math.h>
+++ |+#include <stdio.h>
3 | int main(){
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
9 | scanf("%d",&n);
| ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:10:11: error: expected expression before '>' token
10 | while(n<>0){
| ^
main.c:26:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
26 | printf("%d\n",count);
| ^~~~~~
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s501115634 | p00185 | C | ???#include<stdio.h>
int main(){
int n,p,q,i,j,count=0;
// FILE *fo;
// fo=fopen("data.txt","r");
// fscanf(fo,"%d",&n);
scanf("%d",&n);
while(n!=0){
for(p=1;p<=(n/2);p++){
q=n-p;
for(i=p/2;i>=2;i--)
if(p % i== 0)break;
if(i==1){
for(j=q/2;j>=2;j--)
if(q % j== 0)break;
if(j==1){
// printf("%d %d\n",p,q);
count++;
}
}
}
printf("%d\n",count);
scanf("%d",&n);
}
return 0;
} | main.c:1:1: error: expected identifier or '(' before '?' token
1 | ???#include<stdio.h>
| ^
main.c:1:4: error: stray '#' in program
1 | ???#include<stdio.h>
| ^
|
s971421734 | p00185 | C | ???#include<stdio.h>
#include<math.h>
int main(){
int n,p,q,i,j,count=0;
// FILE *fo;
// fo=fopen("data.txt","r");
// fscanf(fo,"%d",&n);
scanf("%d",&n);
while(n!=0){
for(p=1;p<=(n/2);p++){
q=n-p;
for(i=p/2;i>=2;i--)
if(p % i== 0)break;
if(i==1){
for(j=q/2;j>=2;j--)
if(q % j== 0)break;
if(j==1){
// printf("%d %d\n",p,q);
count++;
}
}
}
printf("%d\n",count);
scanf("%d",&n);
count=0;
}
return 0;
} | main.c:1:1: error: expected identifier or '(' before '?' token
1 | ???#include<stdio.h>
| ^
main.c:1:4: error: stray '#' in program
1 | ???#include<stdio.h>
| ^
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
9 | scanf("%d",&n);
| ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
2 | #include<math.h>
+++ |+#include <stdio.h>
3 | int main(){
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
9 | scanf("%d",&n);
| ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:26:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
26 | printf("%d\n",count);
| ^~~~~~
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s311960450 | p00185 | C | ???#include<stdio.h>
#include<math.h>
int main(){
int n,p,q,i,j,count=0;
// FILE *fo;
// fo=fopen("data.txt","r");
// fscanf(fo,"%d",&n);
scanf("%d",&n);
while(n!=0){
for(p=1;p<=(n/2);p++){
q=n-p;
for(i=p/2;i>=2;i--)
if(p % i== 0)break;
if(i==1){
for(j=q/2;j>=2;j--)
if(q % j== 0)break;
if(j==1){
// printf("%d %d\n",p,q);
count++;
}
}
}
printf("%d\n",count);
scanf("%d",&n);
count=0;
}
return 0;
} | main.c:1:1: error: expected identifier or '(' before '?' token
1 | ???#include<stdio.h>
| ^
main.c:1:4: error: stray '#' in program
1 | ???#include<stdio.h>
| ^
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
9 | scanf("%d",&n);
| ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
2 | #include<math.h>
+++ |+#include <stdio.h>
3 | int main(){
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
9 | scanf("%d",&n);
| ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:26:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
26 | printf("%d\n",count);
| ^~~~~~
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s365149550 | p00185 | C | ???#include<stdio.h>
#include<math.h>
int main(){
int n,p,q,i,j,count=0;
// FILE *fo;
// fo=fopen("data.txt","r");
// fscanf(fo,"%d",&n);
scanf("%d",&n);
while(n!=0){
for(p=1;p<=(n/2);p++){
q=n-p;
for(i=p/2;i>=2;i--)
if(p % i== 0)break;
if(i==1){
for(j=q/2;j>=2;j--)
if(q % j== 0)break;
if(j==1){
// printf("%d %d\n",p,q);
count++;
}
}
}
printf("%d\n",count);
scanf("%d",&n);
count=0;
}
return 0;
} | main.c:1:1: error: expected identifier or '(' before '?' token
1 | ???#include<stdio.h>
| ^
main.c:1:4: error: stray '#' in program
1 | ???#include<stdio.h>
| ^
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
9 | scanf("%d",&n);
| ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
2 | #include<math.h>
+++ |+#include <stdio.h>
3 | int main(){
main.c:9:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
9 | scanf("%d",&n);
| ^~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:26:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
26 | printf("%d\n",count);
| ^~~~~~
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:26:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:26:3: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s221688071 | p00185 | C | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++; | main.c:1:1: warning: data definition has no type or storage class
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^
main.c:1:12: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^
main.c:1:14: error: return type defaults to 'int' [-Wimplicit-int]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^~~~
main.c: In function 'main':
main.c:1:14: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:80: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
main.c:1:80: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^~~~~
main.c:1:80: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:101: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^~~~~~
main.c:1:101: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:101: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:101: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:1: error: expected declaration or statement at end of input
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^
|
s651055105 | p00185 | C | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++; | main.c:1:1: warning: data definition has no type or storage class
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'j' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^
main.c:1:12: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^
main.c:1:14: error: return type defaults to 'int' [-Wimplicit-int]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^~~~
main.c: In function 'main':
main.c:1:14: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:80: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
main.c:1:80: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^~~~~
main.c:1:80: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:101: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^~~~~~
main.c:1:101: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:101: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:101: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:1: error: expected declaration or statement at end of input
1 | j,p[1<<20],n;main(i){for(;++i<999;)if(!p[i])for(j=i+i;j<1<<20;j+=i)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
| ^
|
s577902779 | p00185 | C | #include<stdio.h>
#include<math.h>
#define N 1000000
int prime[N];
int main(){
int i,n,c,j;for(i=0;i<N;i++)prime[i]=1;
prime[0] = prime[1] = 0;
for(i=4;i<N;i+=2)prime[i]=0;
for(i=3;i<N;i+=2){
if(prime[i] == 0 )continue;
for(j=i+i;j<N;j+=i)prime[j]=0;
}
for(;scanf("%d",&n)&&n;){c=0;for(i=0;i<=n/2;i++){if(prime[i]&&prime[n-i])c++;}printf("%d\n",count);}return 0;} | main.c: In function 'main':
main.c:13:101: error: 'count' undeclared (first use in this function)
13 | for(;scanf("%d",&n)&&n;){c=0;for(i=0;i<=n/2;i++){if(prime[i]&&prime[n-i])c++;}printf("%d\n",count);}return 0;}
| ^~~~~
main.c:13:101: note: each undeclared identifier is reported only once for each function it appears in
|
s511131003 | p00185 | C | #include<stdio.h>
#include<string.h>
int main(){
int n,i,j,ans;
bool f[1000005];f[0]=f[1]=false;
memset(f,true,sizeof(f));
for(i=3;i<1000005;i++){
if(f[i]){
for(j=2;i*j<1000005;j++){
f[i*j]=false;}
}
}
while(scanf("%d",&n)!=EOF){
if(n==0)break;ans=0;
for(i=3;i<=n/2;i++){
if(f[i] && f[n-i])ans++;
}
printf("%d\n",ans);
}
return 0;
} | main.c: In function 'main':
main.c:5:9: error: unknown type name 'bool'
5 | bool f[1000005];f[0]=f[1]=false;
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<string.h>
+++ |+#include <stdbool.h>
3 | int main(){
main.c:5:35: error: 'false' undeclared (first use in this function)
5 | bool f[1000005];f[0]=f[1]=false;
| ^~~~~
main.c:5:35: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:5:35: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:18: error: 'true' undeclared (first use in this function)
6 | memset(f,true,sizeof(f));
| ^~~~
main.c:6:18: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s911359896 | p00185 | C | #include<stdio.h>
#include<string.h>
int main(){
int n,i,j,ans;
bool f[1000005];f[0]=f[1]=false;
memset(f,true,sizeof(f));
for(i=3;i<1000005;i++){
if(f[i]){
for(j=2;i*j<1000005;j++){
f[i*j]=false;}
}
}
while(scanf("%d",&n)!=EOF){
if(n==0)break;ans=0;
for(i=3;i<=n/2;i++){
if(f[i] && f[n-i])ans++;
}
printf("%d\n",ans);
}
return 0;
} | main.c: In function 'main':
main.c:5:9: error: unknown type name 'bool'
5 | bool f[1000005];f[0]=f[1]=false;
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<string.h>
+++ |+#include <stdbool.h>
3 | int main(){
main.c:5:35: error: 'false' undeclared (first use in this function)
5 | bool f[1000005];f[0]=f[1]=false;
| ^~~~~
main.c:5:35: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:5:35: note: each undeclared identifier is reported only once for each function it appears in
main.c:6:18: error: 'true' undeclared (first use in this function)
6 | memset(f,true,sizeof(f));
| ^~~~
main.c:6:18: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s835930396 | p00185 | C | #include<stdio.h>
#include<string.h>
int main(){
int n,i,j,ans;
bool f[500005];
memset(f,true,sizeof(f));
f[0]=f[1]=false;
for(i=3;i<500005;i++){
if(f[i]){
for(j=2;i*j<500005;j++){
f[i*j]=false;}
}
}
while(scanf("%d",&n)!=EOF){
if(n==0)break;ans=0;
for(i=3;i<=n/2;i++){
if(f[i] && f[n-i])ans++;
}
printf("%d\n",ans);
}
return 0;
} | main.c: In function 'main':
main.c:5:9: error: unknown type name 'bool'
5 | bool f[500005];
| ^~~~
main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
2 | #include<string.h>
+++ |+#include <stdbool.h>
3 | int main(){
main.c:6:18: error: 'true' undeclared (first use in this function)
6 | memset(f,true,sizeof(f));
| ^~~~
main.c:6:18: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:6:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:7:19: error: 'false' undeclared (first use in this function)
7 | f[0]=f[1]=false;
| ^~~~~
main.c:7:19: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
|
s751921500 | p00185 | C++ | #include <cstdio>
#define MAX 1000000
bool prime[MAX];
void make()
{
fill(prime, prime + MAX, true);
prime[0] = prime[1] = false;
for (int i = 2; i*i < MAX; i++) {
if (prime[i]) {
for (int j = 2*i; j < MAX; j += i) {
prime[j] = false;
}
}
}
}
int main()
{
make();
int n;
while (scanf("%d", &n), n) {
int cnt = 0;
for (int i = 2; i+i <= n; i++) {
if (prime[i] && prime[n-i]) {
cnt++;
}
}
printf("%d\n", cnt);
}
return 0;
} | a.cc: In function 'void make()':
a.cc:9:5: error: 'fill' was not declared in this scope
9 | fill(prime, prime + MAX, true);
| ^~~~
|
s614619435 | p00185 | C++ | #include<iostream>
using namespace std;
#include<cmath>
bool isprime(int n) {
if (n == 2)return true;
if (n % 2 == 0)return false;
for (int i = 3; i <= sqrt(n); i += 2) if (n%i == 0)return false;
return true;
}
int main() {
int n; while (cin >> n, n) {
int cnt = 0;
for (int i = 2; i <= n / 2; i++) {
if (isprime(i) && isprime(n - i)){cnt++;
}
cout << cnt << endl;
}
} | a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
18 | }
| ^
a.cc:10:12: note: to match this '{'
10 | int main() {
| ^
|
s439531875 | p00185 | C++ | #include<iostream>
using namespace std;
#include<cmath>
bool isprime(int n) {
if (n == 2)return true;
if (n % 2 == 0)return false;
for (int i = 3; i <= sqrt(n); i += 2) if (n%i == 0)return false;
return true;
}
int main() {
int n; while (cin >> n, n) {
int cnt = 0;
for (int i = 2; i <= n / 2; i++) {
if (isprime(i) && isprime(n - i)){cnt++;
}
cout << cnt << endl;
}
} | a.cc: In function 'int main()':
a.cc:18:2: error: expected '}' at end of input
18 | }
| ^
a.cc:10:12: note: to match this '{'
10 | int main() {
| ^
|
s830629795 | p00185 | C++ | j,p[1<<20],n;
main(i)
{
for(;++i<999;)
if(!p[i])
for(j=i+i;j<1<<20;j+=i)
p[j]=1;
for(;scanf("%d",&n),j=0,n;printf("%d\n",j))
for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
exit(0);
} | a.cc:1:1: error: 'j' does not name a type
1 | j,p[1<<20],n;
| ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
2 | main(i)
| ^
|
s673083446 | p00185 | C++ | j,p[1<<20],n;
main(i)
{
for(;++i<999;)
if(!p[i])
for(j=i+i;j<1<<20;j+=i)
p[j]=1;
for(;scanf("%d",&n),j=0,n;printf("%d\n",j))
for(i=2;i<=n/2;i++)if(!p[i]&!p[n-i])j++;
exit(0);
} | a.cc:1:1: error: 'j' does not name a type
1 | j,p[1<<20],n;
| ^
a.cc:2:5: error: expected constructor, destructor, or type conversion before '(' token
2 | main(i)
| ^
|
s797562329 | p00185 | C++ | j,p[1<<20],n;main(i){for(;++i<999;)for(j=i;!p[i]&(j+=i)<1<<20;)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=1;++i<=n/2;)j+=!p[i]&!p[n-i];exit(0);} | a.cc:1:1: error: 'j' does not name a type
1 | j,p[1<<20],n;main(i){for(;++i<999;)for(j=i;!p[i]&(j+=i)<1<<20;)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=1;++i<=n/2;)j+=!p[i]&!p[n-i];exit(0);}
| ^
a.cc:1:18: error: expected constructor, destructor, or type conversion before '(' token
1 | j,p[1<<20],n;main(i){for(;++i<999;)for(j=i;!p[i]&(j+=i)<1<<20;)p[j]=1;for(;scanf("%d",&n),j=0,n;printf("%d\n",j))for(i=1;++i<=n/2;)j+=!p[i]&!p[n-i];exit(0);}
| ^
|
s655550624 | p00185 | C++ | #include<stdio.h>
#define MAX 100000
#define sqrtMAX 317
int main(void)
{
int n;
int *b;
b = malloc((MAX+1)*sizeof(int));
int *p;
p = malloc((MAX+1)*sizeof(int));
int *c;
c = malloc((MAX+1)*sizeof(int));
/*
int b[MAX+1] = {0};
int p[MAX+1] = {0};
int c[MAX+1] = {0};
*/
int i, j;
int count;
// ツエツδ可トツスツテツネツスツづ個づ督づゥツつ「
b[0] = 1;
b[1] = 1;
for(i=4; i<=MAX; i+=2)
b[i] = 1;
for(i=3; i<sqrtMAX; i+=2)
for(j=i+i; j<=MAX; j+=i)
b[j] = 1;
// ツ素ツ青板づーツ板イツつォツ出ツつキ
count = 0;
for(i=0; i<=MAX; i++) {
if(b[i])
continue;
p[count++] = i;
}
for(i=0; i<count; i++) {
for(j=i; j<count; j++) {
if(p[i]+p[j] > MAX)
break;
c[p[i]+p[j]]++;
}
}
while(scanf("%d", &n)!=EOF) {
if(n==0)
break;
printf("%d\n", c[n]);
}
free(b);
free(p);
free(c);
return 0;
} | a.cc: In function 'int main()':
a.cc:10:7: error: 'malloc' was not declared in this scope
10 | b = malloc((MAX+1)*sizeof(int));
| ^~~~~~
a.cc:2:1: note: 'malloc' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
1 | #include<stdio.h>
+++ |+#include <cstdlib>
2 |
a.cc:54:3: error: 'free' was not declared in this scope
54 | free(b);
| ^~~~
a.cc:54:3: note: 'free' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>'
|
s598729858 | p00185 | C++ | #include <iostream>
using namespace std;
bool IsPrime[1000001];
void calc()
{
memset(IsPrime, 1, sizeof(IsPrime));
IsPrime[0] = false;
IsPrime[1] = false;
for(int i = 2; i < 1000001; ++i)
{
if(IsPrime[i])
{
for(int j = 2 * i; j < 1000001; j += i)
{
IsPrime[j] = false;
}
}
}
}
void solve()
{
calc();
int n;
while(cin >> n, n)
{
int count = 0;
int temp = n / 2;
for(int i = 0; i <= temp; ++i)
{
if(IsPrime[i] == 1 && IsPrime[n - i] == 1)
{
count++;
}
}
cout << count << endl;
}
}
int main()
{
solve();
return(0);
} | a.cc: In function 'void calc()':
a.cc:8:9: error: 'memset' was not declared in this scope
8 | memset(IsPrime, 1, sizeof(IsPrime));
| ^~~~~~
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 |
|
s840524589 | p00185 | C++ | 134
4330
34808
98792
0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 134
| ^~~
|
s471766294 | p00185 | C++ | #include<iostream>
#define N 1000001
using namespace std;
int main(){
int n;
int p[N]={0};
for(int i=3;i<=N;i+=2;) p[i] = 1;
p[2] = 1;
for(int i=3;i<=1000;i+=2){
if(p[i]==1){
for(int j=2*i;j<=N;j+=i) p[j] = 0;
}
}
while(cin>>n){
int count = 0;
if(n==0) break;
int j = n - 2;
if(p[j]==1) count++;
for(int i=3;i<=n/2;i+=2){
if(p[i]==1) j = n - i;
if(p[j]==1) count++;
}
cout << count << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:7:24: error: expected ')' before ';' token
7 | for(int i=3;i<=N;i+=2;) p[i] = 1;
| ~ ^
| )
a.cc:7:25: error: expected primary-expression before ')' token
7 | for(int i=3;i<=N;i+=2;) p[i] = 1;
| ^
|
s209256829 | p00185 | C++ | #include <cstdio>
#define MAX 1000000
bool prime[MAX];
void make(){
fill(prime,prime+MAX,true);
prime[0] = prime[1] = false;
for(int i = 2 ; i*i < MAX ; i++){
if(prime[i]){
for(int j = 2*i ; j < MAX ; j += i){
prime[j] = false;
}
}
}
}
int main(){
make();
int n;
while(scanf("%d" ,&n),n){
int cnt = 0;
for(int i = 2 ; i+i <= n ; i++){
if(prime[i] && prime[n-i]){
cnt++;
}
}
printf("%d\n" ,cnt);
}
return 0;
} | a.cc: In function 'void make()':
a.cc:8:3: error: 'fill' was not declared in this scope
8 | fill(prime,prime+MAX,true);
| ^~~~
|
s897680358 | p00185 | C++ | #include <cstdio>
#define MAX 1000000
bool prime[MAX];
void make(){
fill(prime,prime+MAX,true);
prime[0] = prime[1] = false;
for(int i = 2 ; i*i < MAX ; i++){
if(prime[i]){
for(int j = 2*i ; j < MAX ; j += i){
prime[j] = false;
}
}
}
}
int main(){
make();
int n;
while(scanf("%d" ,&n),n){
int cnt = 0;
for(int i = 2 ; i+i <= n ; i++){
if(prime[i] && prime[n-i]){
cnt++;
}
}
printf("%d\n" ,cnt);
}
return 0;
} | a.cc: In function 'void make()':
a.cc:8:3: error: 'fill' was not declared in this scope
8 | fill(prime,prime+MAX,true);
| ^~~~
|
s817234006 | p00186 | C++ | #include<iostream>
using namespace std;
typedef long long ll;
int main(){
????ll q1,b,c1,c2,q2;
????cin >> q1;
????while(q1!=0){
????????cin >> b >> c1 >> c2 >> q2;
????????ll x1=0,x2=0,m=min(c1,c2);
????????bool f=false;
????????//cout << b-min(c1,c2)*q1 << endl;
??????????
????????if(c1<=c2){
????????????if(b<c1*q2+c2*(q1-q2)) f=true;
????????????while(b>=c1*(x1+1)&&x1<q2) x1++;
????????????while(b>=c1*x1+c2*(x2+1)) x2++;
????????????if(x1==0) f=true;
????????????if(f) cout << "NA" << endl;
????????????else cout << x1 << " " << x2 << endl;
????????????cin >> q1;
????????}else{
????????????if(b<m*q1) f=true;
????????????ll s=c1-c2,sum=0;
????????????sum=q1*m;
????????????while(b-sum>=s*(x1+1)&&x1<q1&&x1<q2) {
????????????????x1++;
????????????????//cout << b-sum<<":"<<s*x1<<endl;
????????????????//cout << x1<<":"<<c1*x1<<endl;
????????????}
????????????if(x1==q1)
????????????????while(b>=c1*(x1+1)&&x1 + 1<=q2) x1++;
????????????//while(b>=c1*x1+c2*(x2+1)) x2++;
??????????????
????????????if(x1==0) f=true;
????????????x2=0;
????????????while(b>=c1*x1+c2*(x2+1)) x2++;
????????????if(f) cout << "NA" << endl;
????????????else cout << x1 << " " << x2 << endl;
????????????//cout << c1*x1+c2*x2 << endl;
????????????cin >> q1;
????????}
????}
????return 0;
} | a.cc:11:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
11 | ????????//cout << b-min(c1,c2)*q1 << endl;
a.cc:27:15: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
27 | ????????????????//cout << b-sum<<":"<<s*x1<<endl;
a.cc:28:15: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
28 | ????????????????//cout << x1<<":"<<c1*x1<<endl;
a.cc:32:11: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
32 | ????????????//while(b>=c1*x1+c2*(x2+1)) x2++;
a.cc:39:11: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
39 | ????????????//cout << c1*x1+c2*x2 << endl;
a.cc: In function 'int main()':
a.cc:5:1: error: expected primary-expression before '?' token
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:2: error: expected primary-expression before '?' token
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:3: error: expected primary-expression before '?' token
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:4: error: expected primary-expression before '?' token
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:8: error: expected primary-expression before 'q1'
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:7: error: expected ':' before 'q1'
5 | ????ll q1,b,c1,c2,q2;
| ^~~
| :
a.cc:5:8: error: 'q1' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:11: error: 'b' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:13: error: 'c1' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:16: error: 'c2' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:19: error: 'q2' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:21: error: expected ':' before ';' token
5 | ????ll q1,b,c1,c2,q2;
| ^
| :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:5:21: error: expected ':' before ';' token
5 | ????ll q1,b,c1,c2,q2;
| ^
| :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:5:21: error: expected ':' before ';' token
5 | ????ll q1,b,c1,c2,q2;
| ^
| :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:6:1: error: expected primary-expression before '?' token
6 | ????cin >> q1;
| ^
a.cc:6:2: error: expected primary-expression before '?' token
6 | ????cin >> q1;
| ^
a.cc:6:3: error: expected primary-expression before '?' token
6 | ????cin >> q1;
| ^
a.cc:6:4: error: expected primary-expression before '?' token
6 | ????cin >> q1;
| ^
a.cc:6:14: error: expected ':' before ';' token
6 | ????cin >> q1;
| ^
| :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
6 | ????cin >> q1;
| ^
| :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
6 | ????cin >> q1;
| ^
| :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
6 | ????cin >> q1;
| ^
| :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:7:1: error: expected primary-expression before '?' token
7 | ????while(q1!=0){
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ????while(q1!=0){
| ^
a.cc:7:3: error: expected primary-expression before '?' token
7 | ????while(q1!=0){
| ^
a.cc:7:4: error: expected primary-expression before '?' token
7 | ????while(q1!=0){
| ^
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:7:5: error: expected ':' before 'while'
7 | ????while(q1!=0){
| ^~~~~
| :
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:7:5: error: expected ':' before 'while'
7 | ????while(q1!=0){
| ^~~~~
| :
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:7:5: error: expected ':' before 'while'
7 | ????while(q1!=0){
| ^~~~~
| :
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:7:5: error: expected ':' before 'while'
7 | ????while(q1!=0){
| ^~~~~
| :
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:43:1: error: expected primary-expression before '?' token
43 | ????return 0;
| ^
a.cc:43:2: error: expected primary-expression before '?' token
43 | ????return 0;
| ^
a.cc:43:3: error: expected primary-expression before '?' token
43 | ????return 0;
| ^
a.cc:43:4: error: expected primary-expression before '?' token
43 | ????return 0;
| ^
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
43 | ????return 0;
| ^~~~~~
| :
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
43 | ????return 0;
| ^~~~~~
| :
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
43 | ????return 0;
| ^~~~~~
| :
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
43 | ????return 0;
| ^~~~~~
| :
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
|
s547631164 | p00186 | C++ | #include<iostream>
using namespace std;
typedef long long ll;
int main(){
????ll q1,b,c1,c2,q2;
????cin >> q1;
????while(q1!=0){
????????cin >> b >> c1 >> c2 >> q2;
????????ll x1=0,x2=0,m=min(c1,c2);
????????bool f=false;
????????//cout << b-min(c1,c2)*q1 << endl;
??????????
????????if(c1<=c2){
????????????if(b<c1*q2+c2*(q1-q2)) f=true;
????????????while(b>=c1*(x1+1)&&x1<q2) x1++;
????????????while(b>=c1*x1+c2*(x2+1)) x2++;
????????????if(x1==0) f=true;
????????????if(f) cout << "NA" << endl;
????????????else cout << x1 << " " << x2 << endl;
????????????cin >> q1;
????????}else{
????????????if(b<m*q1) f=true;
????????????ll s=c1-c2,sum=0;
????????????sum=q1*m;
????????????while(b-sum>=s*(x1+1)&&x1<q1&&x1<q2) {
????????????????x1++;
????????????????//cout << b-sum<<":"<<s*x1<<endl;
????????????????//cout << x1<<":"<<c1*x1<<endl;
????????????}
????????????if(x1==q1)
????????????????while(b>=c1*(x1+1)&&x1 + 1<=q2) x1++;
????????????//while(b>=c1*x1+c2*(x2+1)) x2++;
??????????????
????????????if(x1==0) f=true;
????????????x2=0;
????????????while(b>=c1*x1+c2*(x2+1)) x2++;
????????????if(f) cout << "NA" << endl;
????????????else cout << x1 << " " << x2 << endl;
????????????//cout << c1*x1+c2*x2 << endl;
????????????cin >> q1;
????????}
????}
????return 0;
} | a.cc:11:7: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
11 | ????????//cout << b-min(c1,c2)*q1 << endl;
a.cc:27:15: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
27 | ????????????????//cout << b-sum<<":"<<s*x1<<endl;
a.cc:28:15: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
28 | ????????????????//cout << x1<<":"<<c1*x1<<endl;
a.cc:32:11: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
32 | ????????????//while(b>=c1*x1+c2*(x2+1)) x2++;
a.cc:39:11: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs]
39 | ????????????//cout << c1*x1+c2*x2 << endl;
a.cc: In function 'int main()':
a.cc:5:1: error: expected primary-expression before '?' token
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:2: error: expected primary-expression before '?' token
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:3: error: expected primary-expression before '?' token
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:4: error: expected primary-expression before '?' token
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:8: error: expected primary-expression before 'q1'
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:7: error: expected ':' before 'q1'
5 | ????ll q1,b,c1,c2,q2;
| ^~~
| :
a.cc:5:8: error: 'q1' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:11: error: 'b' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^
a.cc:5:13: error: 'c1' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:16: error: 'c2' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:19: error: 'q2' was not declared in this scope
5 | ????ll q1,b,c1,c2,q2;
| ^~
a.cc:5:21: error: expected ':' before ';' token
5 | ????ll q1,b,c1,c2,q2;
| ^
| :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:5:21: error: expected ':' before ';' token
5 | ????ll q1,b,c1,c2,q2;
| ^
| :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:5:21: error: expected ':' before ';' token
5 | ????ll q1,b,c1,c2,q2;
| ^
| :
a.cc:5:21: error: expected primary-expression before ';' token
a.cc:6:1: error: expected primary-expression before '?' token
6 | ????cin >> q1;
| ^
a.cc:6:2: error: expected primary-expression before '?' token
6 | ????cin >> q1;
| ^
a.cc:6:3: error: expected primary-expression before '?' token
6 | ????cin >> q1;
| ^
a.cc:6:4: error: expected primary-expression before '?' token
6 | ????cin >> q1;
| ^
a.cc:6:14: error: expected ':' before ';' token
6 | ????cin >> q1;
| ^
| :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
6 | ????cin >> q1;
| ^
| :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
6 | ????cin >> q1;
| ^
| :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:6:14: error: expected ':' before ';' token
6 | ????cin >> q1;
| ^
| :
a.cc:6:14: error: expected primary-expression before ';' token
a.cc:7:1: error: expected primary-expression before '?' token
7 | ????while(q1!=0){
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ????while(q1!=0){
| ^
a.cc:7:3: error: expected primary-expression before '?' token
7 | ????while(q1!=0){
| ^
a.cc:7:4: error: expected primary-expression before '?' token
7 | ????while(q1!=0){
| ^
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:7:5: error: expected ':' before 'while'
7 | ????while(q1!=0){
| ^~~~~
| :
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:7:5: error: expected ':' before 'while'
7 | ????while(q1!=0){
| ^~~~~
| :
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:7:5: error: expected ':' before 'while'
7 | ????while(q1!=0){
| ^~~~~
| :
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:7:5: error: expected ':' before 'while'
7 | ????while(q1!=0){
| ^~~~~
| :
a.cc:7:5: error: expected primary-expression before 'while'
7 | ????while(q1!=0){
| ^~~~~
a.cc:43:1: error: expected primary-expression before '?' token
43 | ????return 0;
| ^
a.cc:43:2: error: expected primary-expression before '?' token
43 | ????return 0;
| ^
a.cc:43:3: error: expected primary-expression before '?' token
43 | ????return 0;
| ^
a.cc:43:4: error: expected primary-expression before '?' token
43 | ????return 0;
| ^
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
43 | ????return 0;
| ^~~~~~
| :
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
43 | ????return 0;
| ^~~~~~
| :
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
43 | ????return 0;
| ^~~~~~
| :
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
a.cc:43:5: error: expected ':' before 'return'
43 | ????return 0;
| ^~~~~~
| :
a.cc:43:5: error: expected primary-expression before 'return'
43 | ????return 0;
| ^~~~~~
|
s261145957 | p00186 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(cin>>n,n){
int have,price[2],up;
cin>>have>>price[0]>>price[1]>>up;
bool kawa=0;
for(int i=up;i>0;i--){
if(have<price[0]*i)continue;
for(int j=n-i;;j++){
if(have-price[0]*i-price[1]*j<0){
if(i+j-1>=n){
kawa=1;
have=j-1;
}
break;
}
}
if(kawa){
cout<<i<<" "<<have<<endl;
}
}
if(!kawa)cout<<"NA\n"
}
} | a.cc: In function 'int main()':
a.cc:25:30: error: expected ';' before '}' token
25 | if(!kawa)cout<<"NA\n"
| ^
| ;
26 | }
| ~
|
s792991831 | p00186 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include<functional>
#include<list>
#include<unordered_map>
#include<map>
#define int long long
using namespace std;
int main() {
int a, b, c, d, e;
while (cin >> a, a) {
cin >> b >> c >> d >> e;
if (b / c < a&&b / d < a) { puts("NA"); continue; }
int s = 1, g = e+1;
while (g - s > 1) {//????´\??°?¶????K??°????????\???????????????
int k = (s + g) / 2;
int f = c*k;
if (f > b) { g = k; continue; }
f = b-f;
f = f / d;
if (k + f >= a) {
s = k;
}
else {
g = k;
}
}
cout << s<<" "<<(b - (s*c))/d << endl;
}
} | cc1plus: error: '::main' must return 'int'
|
s933732864 | p00186 | C++ | #include<iostream>
using namespace std;
int q1,q2,b,c1,c2,ans1,ans2;
bool solve(){
if(!q2)
return false;
ans1 = q2;
ans2 = 0;
while(ans1*c1 + ans2*c2 <= b)
ans2++;
if(ans2)
ans2--;
if(ans1 + ans2 >= q1 && ans1*c1 + ans2*c2 <= b)
return true;
while(true){
ans1--;
// if(!ans1)
// return false;
while(true){
ans2++;
if(ans1*c1 + ans2*c2 > b){
ans2--;
break;
}
}
if(ans1*c1 + ans2*c2 <= b && ans1 + ans2 >= q1) || ans1 == 0)
break;
}
if(!ans1)
return false;
else
return true;
}
int main(){
while(true){
cin >> q1;
if(!q1)
return 0;
cin >> b >> c1 >> c2 >> q2;
if(solve())
cout << ans1 << ' ' << ans2 << endl;
else
cout << "NA" << endl;
}
} | a.cc: In function 'bool solve()':
a.cc:28:65: error: expected primary-expression before '||' token
28 | if(ans1*c1 + ans2*c2 <= b && ans1 + ans2 >= q1) || ans1 == 0)
| ^~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.