現在のタイムスタンプを2乗してから400000007で割り、残りをdat時間に変換するspoj問題を解決しています..
remainder = result%4000000007 ;
printf("%ul\n",remainder);
//convert the timestamp into date , time
dt = localtime(&remainder);
// use any strftime format spec here
// strftime(b, sizeof(b), "%m%d%H%M%y", dt);
// fprintf(stdout, "%s", b);
// printf("%s\n",asctime(localtime(&remainder)));
ltime = (time_t)remainder;
printf("%s\n",asctime(dt));
printf("%s\n",ctime(<ime));
表示されているエラーは セグメンテーション違反 であり、time_t 変数でasctime
もltime
あり、'b' はバッファーで dt
あり、構造体 tm * であり、残りを変数に変換しようとしましたtime_t
が、まだ作業が進んでいません。また、コメント付きのコードは私の試みを示しています。デバッガーを使用すると、asctime が null を返すことがわかりました。
問題はどこだ ?