與正確輸出不相符(line:1)
您的答案為: 4
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a, b, c, i, x, y, z ;
while (cin >> a)
{
i = 1 ;
x = y = z = 0 ;
while (i <= a)
{
cin >> b ;
if (b >= 1 && b <= 50000)
{
c = b % 3 ;
if (c == 0)
x += 1 ;
else if (c == 1)
y += 1 ;
else if (c == 2)
z += 1 ;
i ++ ;
}
}
cout << x << '\0' << y << '\0' << z << endl ;
}
return 0;
}
謝謝大家
與正確輸出不相符(line:1)
您的答案為: 4
#include
using namespace std;
int main(int argc, char *argv[])
{
int a, b, c, i, x, y, z ;
while (cin >> a)
{
i = 1 ;
x = y = z = 0 ;
while (i <= a)
{
cin >> b ;
if (b >= 1 && b <= 50000)
{
c = b % 3 ;
if (c == 0)
x += 1 ;
else if (c == 1)
y += 1 ;
else if (c == 2)
z += 1 ;
i ++ ;
}
}
cout << x << '\0' << y << '\0' << z << endl ;
}
return 0;
}
謝謝大家
把'\0'改成" "就行了