您或許執行了不正確的系統指令。 /6254336/code_6254336.exe: error while loading shared libraries: libc.so.6: failed to map segment from shared object
code(c++):
#include <iostream> inline int read(int *num) { *num=0; register char c = getchar_unlocked(); if(c==EOF) return EOF; while('0'<=c && c<='9') { *num = *num * 10 + (c-'0'); c = getchar_unlocked(); } return 1; } int main() { register int g, c; long long int TotalScore = 0, TotalCredit = 0; while(read(&g)!=EOF && read(&c)!=EOF) { TotalScore += g*c; TotalCredit += c; } if(TotalScore/TotalCredit >= 60) { puts("Oh wow! You pass it!\n"); printf("%lld\n", TotalScore/TotalCredit); } else puts("YEEEEEE!!!"); return 0; }
請問這題的輸入我哪裡寫錯了嗎?還是邏輯不正確?
全部都是:
#0: 3% RE (code:127)
您或許執行了不正確的系統指令。 /6254336/code_6254336.exe: error while loading shared libraries: libc.so.6: failed to map segment from shared object
code(c++):
#include inline int read(int *num) { *num=0; register char c = getchar_unlocked(); if(c==EOF) return EOF; while('0'<=c && c<='9') { *num = *num * 10 + (c-'0'); c = getchar_unlocked(); } return 1; } int main() { register int g, c; long long int TotalScore = 0, TotalCredit = 0; while(read(&g)!=EOF && read(&c)!=EOF) { TotalScore += g*c; TotalCredit += c; } if(TotalScore/TotalCredit >= 60) { puts("Oh wow! You pass it!\n"); printf("%lld\n", TotalScore/TotalCredit); } else puts("YEEEEEE!!!"); return 0; }
把#include<iostream>改成#include<stdio.h>
就AC啦(我猜可能是從iostream李拿stdio.h時出了狀況?)
還有把register拿掉會更快(我本來以為會更慢)
請問這題的輸入我哪裡寫錯了嗎?還是邏輯不正確?
全部都是:
#0: 3% RE (code:127)
您或許執行了不正確的系統指令。 /6254336/code_6254336.exe: error while loading shared libraries: libc.so.6: failed to map segment from shared object
code(c++):
#include inline int read(int *num) { *num=0; register char c = getchar_unlocked(); if(c==EOF) return EOF; while('0'<=c && c<='9') { *num = *num * 10 + (c-'0'); c = getchar_unlocked(); } return 1; } int main() { register int g, c; long long int TotalScore = 0, TotalCredit = 0; while(read(&g)!=EOF && read(&c)!=EOF) { TotalScore += g*c; TotalCredit += c; } if(TotalScore/TotalCredit >= 60) { puts("Oh wow! You pass it!\n"); printf("%lld\n", TotalScore/TotalCredit); } else puts("YEEEEEE!!!"); return 0; }
把#include改成#include就AC啦(我猜可能是從iostream李拿stdio.h時出了狀況?)
還有把register拿掉會更快(我本來以為會更慢)
謝謝指教,已AC