Lỗi khi chấm bằng Themis

đề bài:


code:

#include <iostream>
#include <cmath>
#include <cstring>
#include <vector>
using namespace std;
const int MAXn =1e4+1;
int n, num;
bool a[MAXn];
vector<int> b;
bool era(){
    memset(a, true, sizeof(a));
    a[0]=a[1]=false;
    for(int i=2; i<=trunc(sqrt(n)); i++)
        if(a[i])
            for(int j=2; j<=n/i; j++)
                a[i*j]=false;
}
int somu(int p){
    int sum=0, l=n;
    while(l!=0){
        sum+=l/p;
        l/=p;
    }
    return sum;
}
int main(){
    freopen("PFACTOR.INP", "r", stdin);
    freopen("PFACTOR.OUT", "w", stdout);
    cin >> n;
    era();
    for(int i=1; i<=n; i++)
    if(a[i]) b.push_back(i);
    for(int i=0; i<b.size(); i++)
        if(somu(b[i])!=0){
            cout << b[i] << "^" << somu(b[i]);
            num=i;
            break;
        }
    for(int i=num+1; i<b.size(); i++)
        if(somu(b[i])!=0)
            cout << " * " << b[i] << "^" << somu(b[i]);
    return 0;
}

khi em chạy tay bài này thì kết quả ra đúng, nhưng khi chạy themis lại ra lỗi;-;

■ PFACTOR: 
● PFACTOR: 0.00
PFACTOR.cpp
"C:\Program Files (x86)\Themis\gcc\bin\g++.exe" -std=c++14 "PFACTOR.cpp" -pipe -O2 -s -static -lm -x c++ -o"PFACTOR.exe" -Wl,--stack,66060288|@WorkDir=C:\ProgramData\ThemisWorkSpace\WaitRoom58200\
PFACTOR.cpp: In function 'bool era()':
PFACTOR.cpp:17:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Dịch thành công.
◆ Test01: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom26553\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test02: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom15363\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test03: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom18236\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test04: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom41298\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test05: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom34558\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test06: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom21009\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test07: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom11221\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test08: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom54455\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test09: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom21964\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)
◆ Test10: 0.00
Chạy sinh lỗi
Command: "C:\ProgramData\ThemisWorkSpace\ContestRoom65520\PFACTOR.exe" terminated with exit code: 3221225477 (Hexadecimal: C0000005)

Xin các ad giúp em, em cảm ơn^^

mình thấy log nó có ghi đây bạn.

4 Likes

ừ ha:))) cảm ơn nhaa

83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?