求解,这两道题用C语言怎么写

img

img

如有帮助,望点击我回答右上角【采纳】按钮。

#include <stdio.h>
#include <math.h> 
int check(int n)
{
    int i;
    while(n)
    {
        i=n%10;
        if(i==0 || i==1 || i==2 || i==9)
            return 1;
        n/=10;
    }
    return 0;
}
int main ()
{
    int i;
    long long sum = 0;
    for(i=1;i<=2019;i++)
    {
        if(check(i)==1)
        {
            sum+=pow(i,2);
        }
    }
    printf("%lld",sum);
    return 0;
 } 
#include <stdio.h>
int main(){
int x=10000;
int time=0;
while(1){
    x-=600;    
    time+=60;
    x+=300;
    time+=60;
    if (x<600)
        break;
}
while(x!=0){
    x-=10;
    time+=1;
}
printf("%d",time);
return 0;
}