#include <stdio.h>
int main(void)
{
int n, q; //nは数列の長さ、qは試行回数
int l, r; //l番目からr番目まで
long t; //tに置き換える
long s[200];
scanf("%d %d", &n, &q);
//配列初期化
int i, j;
for (i = 0; i < n; i++)
s[i] = 0;
for (i = 0; i < q; i++) { //試行回数
scanf("%d %d %d", &l, &r, &t);
for (j = l; j <= r; j++) { //置き換え
s[j-1] = t;
}
}
for (i = 0; i < n; i++)
printf("%d\n", s[i]);
return 0;
}
./Main.c: In function ‘main’:
./Main.c:23:11: warning: format ‘%d’ expects argument of type ‘int *’, but argument 4 has type ‘long int *’ [-Wformat=]
scanf("%d %d %d", &l, &r, &t);
^
./Main.c:30:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
printf("%d\n", s[i]);
^
./Main.c:11:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &n, &q);
^
./Main.c:23:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d", &l, &r, &t);
^