Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- P3
- 3 2
- 255
- 255 0 0 0 255 0 0 0 255
- 255 255 0 255 255 255 0 0 0
- #include <stdio.h>
- int main(){
- int height;
- int width;
- int max;
- int magicnum;
- int count;
- unsigned int currentpixel;
- unsigned int currentred;
- unsigned int currentgreen;
- unsigned int currentblue;
- if(scanf("P%d", magicnum) <= 0){
- return 1;
- }
- if(magicnum != 3){
- return 1;
- }
- if(scanf("%d%d%d", width, height, size) < 3){
- return 1;
- }
- count = 0;
- if(count < width*height){
- scanf("%d%d%d", currentred, currentgreen, currentblue){
- currentpixel = ((currentred*30)+(currentgreen*59)+(currentblue*11) / 100) * 255 / size;
- count ++;
- printf("%d ", currentpixel);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement