fork download
  1. program kmetric(input,output);
  2. { computes a "circle" with k=2 }
  3.  
  4. uses Math;
  5.  
  6. var
  7. n:integer; { size of matrix}
  8. k:Double; { exponent for average }
  9. r:Double; { radius }
  10. i,j: integer; { row/column counters }
  11.  
  12. begin
  13. readln(n,k);
  14. for i:=n downto 0 do
  15. begin
  16. for j:=0 to n do
  17. begin
  18. r:=Power(Power(i/n,k)+Power(j/n,k),1/k);
  19. if r>1 then
  20. write('*')
  21. else
  22. write(' ');
  23. end;
  24. writeln;
  25. end;
  26. end.
  27.  
Success #stdin #stdout 0s 400KB
stdin
26 1.26
stdout
 **************************
   ************************
     **********************
      *********************
       ********************
         ******************
          *****************
           ****************
            ***************
             **************
              *************
               ************
                ***********
                 **********
                  *********
                   ********
                    *******
                     ******
                      *****
                      *****
                       ****
                        ***
                         **
                         **
                          *
                          *