#2765
CheckColor
Dându-se trei numere, R
, G
și B
, verificați dacă acestea pot reprezenta o culoare sau o nuanță de gri. O culoare se consideră nuanță de gri dacă și numai dacă diferența dintre oricare două coduri ce reprezintă culorile primare nu depășește 10
.
Best of CNCV /w 2018
Problema | CheckColor | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 8 MB
/
Stivă 8 MB
|
Id soluție | #50161378 | Utilizator | |
Fișier | checkcolor.cpp | Dimensiune | 418 B |
Data încărcării | 29 Martie 2024, 09:41 | Scor / rezultat | Eroare de compilare |
checkcolor.cpp: In function 'int main()': checkcolor.cpp:8:26: error: expected primary-expression before '<=' token if(r && g && b>=0 && <=255) ^ checkcolor.cpp:10:9: error: 'd1' was not declared in this scope d1=r-g; ^ checkcolor.cpp:12:5: error: 'd1' was not declared in this scope d1=g-r; ^ checkcolor.cpp:8:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(r && g && b>=0 && <=255) ^ checkcolor.cpp:14:9: error: 'd2' was not declared in this scope d2=r-b; ^ checkcolor.cpp:16:9: error: 'd2' was not declared in this scope d2=b-r; ^ checkcolor.cpp:18:9: error: 'd3' was not declared in this scope d3=g-b; ^ checkcolor.cpp:20:9: error: 'd3' was not declared in this scope d3=b-g; ^ checkcolor.cpp:21:8: error: 'd1' was not declared in this scope if(d1 && d2 && d3<10) ^ checkcolor.cpp:21:14: error: 'd2' was not declared in this scope if(d1 && d2 && d3<10) ^ checkcolor.cpp:21:20: error: 'd3' was not declared in this scope if(d1 && d2 && d3<10) ^ checkcolor.cpp:23:5: error: expected ';' before 'else' else ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CheckColor face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.