先複習禮拜一的題目
第一題:【進階題:利用自訂函式最大值max與最小值min求出兩者之差】
第二題:【進階題:字串中的數字個數】
第三題:【進階題:奇數之和 】
第四題:【進階題:判斷迴文 】
第四-2題:【進階題:判斷迴文( 不用 string.h 的 strlen(line) 算長度)】
第五題:【CPE考題:Hashmat the brave warrior 】
另一種解法
#include <stdio.h>
int main()
{
long long x,y;
while(scanf("%lld%lld",&x,&y)!=EOF) ///End Of File=直到資料結束
{
if(y>x) printf("%lld\n",y-x);
else printf("%lld\n",x-y);
}
}
【小精靈遊戲】
首先開啟Processing
void setup()
{
size (300,200); ///視窗大小
}
int angle=45;
void draw()
{
background(255); ///背景顏色-白色
angle=mouseX; ///嘴巴張開的角度 隨著游標左右移動開合
arc(100,100,100,100,radians(angle),radians(360-angle),PIE);
}
void setup()
{
size (300,200);
}
int angle=45;
void draw()
{
background(255);
angle=(frameCount*2)%120; ///嘴巴自動開合,最大角度到120度
if(angle>60) angle=120-angle;
arc(100,100,100,100,
radians(angle+270),radians(360-angle+270),PIE);
}
void setup()
{
size (300,200);
}
int angle=45;
void draw()
{
background(255);
angle=(frameCount*2)%120;
if(angle>60) angle=120-angle;
fill(255,251,0);
arc(100,100,100,100,radians(angle+270),radians(360-angle+270),PIE);
}
沒有留言:
張貼留言