結果
| 問題 | 
                            No.864 四方演算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-08-17 02:18:45 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 12 ms / 1,000 ms | 
| コード長 | 287 bytes | 
| コンパイル時間 | 551 ms | 
| コンパイル使用メモリ | 65,284 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-25 10:48:47 | 
| 合計ジャッジ時間 | 1,615 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 27 | 
コンパイルメッセージ
main.cpp:10:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   10 | main()
      | ^~~~
            
            ソースコード
#include<iostream>
using namespace std;
long N,K,ans;
long f(long L)
{
	if(L<=N)return L-1;
	else if(L<=2*N)return 2*N-L+1;
	else return 0;
}
main()
{
	cin>>N>>K;
	for(long i=1;i*i<=K;i++)
	{
		if(K%i==0)
		{
			long now=f(i)*f(K/i);
			ans+=now*(i*i==K?1:2);
		}
	}
	cout<<ans<<endl;
}