結果

問題 No.589 Counting Even
ユーザー vjudge1
提出日時 2025-08-21 20:15:11
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 870 bytes
コンパイル時間 3,127 ms
コンパイル使用メモリ 274,884 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-08-21 20:15:16
合計ジャッジ時間 4,193 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:26: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 | #define FileIn(x) freopen(x".in","r",stdin)
      |                   ~~~~~~~^~~~~~~~~~~~~~~~~~
main.cpp:18:19: note: in expansion of macro ‘FileIn’
   18 | #define FileIO(x) FileIn(x),FileOut(x);
      |                   ^~~~~~
main.cpp:29:5: note: in expansion of macro ‘FileIO’
   29 |     FileIO("even");
      |     ^~~~~~
main.cpp:17:27: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 | #define FileOut(x) freopen(x".out","w",stdout)
      |                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~
main.cpp:18:29: note: in expansion of macro ‘FileOut’
   18 | #define FileIO(x) FileIn(x),FileOut(x);
      |                             ^~~~~~~
main.cpp:29:5: note: in expansion of macro ‘FileIO’
   29 |     FileIO("even");
      |     ^~~~~~

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
#define fi first
#define sc second
#define pii pair<int,int>
#define pdd pair<double,double>
#define pb push_back
#define umap unordered_map
#define mset multiset
#define pq priority_queue
#define ull unsigned long long
#define i128 __int128
#define ld long double
#define fixs fixed<<setprecision
#define FileIn(x) freopen(x".in","r",stdin)
#define FileOut(x) freopen(x".out","w",stdout)
#define FileIO(x) FileIn(x),FileOut(x);
int n;
int f(int x){
    int s=1;
    while(x) s*=((x&1)+1),x>>=1;
    return s;
}
void solve(){
    cin>>n,cout<<n+1-f(n)<<endl;
}
signed main(){
    FileIO("even");
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0;
}
/*
Samples
input:

output:

THINGS TODO:
??freopen???????
????
????????????
*/
0