結果

問題 No.544 Delete 7
ユーザー Bantako
提出日時 2017-07-15 18:47:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 450 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 23,040 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 16:18:00
合計ジャッジ時間 1,688 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 48
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:10:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   10 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#define MAX_N 1000000000
int pow(int n){
    int num = 1;
    for(int i = 0;i < n;i++){
        num *= 10;
    }
    return num;
}
main(){
    int N;
    scanf("%d",&N);
    int num;
    int a = 0,b = 0;
    for(int i = 0;i < 10;i++){
        num = N%10;
        N/=10;
        if(num==7){
            a += 3*pow(i);
            b += 4*pow(i);
        }else{
            a += num*pow(i);
        }
    }
    printf("%d %d\n",a,b);
}
0