Submission #1070386
Source Code Expand
#include <iostream>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
typedef long double ld;
typedef long long ll;
using namespace std;
const ll MX=5e6+9;
const ld pi = acos(-1);
const ll mod = 1e8;
//bool cmp ( int a,int b ) { return a>b; }
ll po ( ll a , ll b )
{
if ( b==0 ) { return 1; }
ll x = po ( a , b/2 );
x *= x%mod;
if ( b%2 ) { x*=a%mod; }
return x%mod;
}
ll gcd ( ll a , ll b )
{
if ( b==0 ) return a;
else { gcd( b , a%b ); }
}
bool cmp ( int a , int b ) { return (a>b); }
int dx[]={ 0 , 0 , -1 , 1 , 1 , -1 , -1 , 1 };
int dy[]={ 1 , -1 , 0 , 0 , 1 , -1 , 1 , -1 };
ll a[MX],b[MX],c[MX];
int n,m,l;
ll bs ( ll x , ll id )
{
ll st,en,mid;
if ( id==2 )
{
st=0,en=m;
}
else { st=0,en=l; }
ll ans=0;
if ( id==2 ){
ans=m-1;
while ( st<=en )
{
mid = st+(en-st)/2;
if ( b[mid]>=x ) { ans=mid; en=mid-1; }
else { st=mid+1; }
}
}
else
{
ans=l-1;
while ( st<=en )
{
mid = st+(en-st)/2;
if ( c[mid]>=x ) { ans=mid; en=mid-1; }
else { st=mid+1; }
}
}
return ans;
}
int main()
{
int k,s;
cin>>k>>s;
int ans=0;
for ( int i=0 ; i<=k ; i++ )
{
for ( int j=0 ; j<=k ; j++ )
{
int x = i+j;
if ( s-(i+j)<=k && s-(i+j)>=0 ) { ans++; }
}
}
cout<<ans;
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Sum of Three Integers |
User |
Reckt |
Language |
C++14 (GCC 5.4.1) |
Score |
200 |
Code Size |
1871 Byte |
Status |
AC |
Exec Time |
9 ms |
Memory |
256 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
Status |
|
|
Set Name |
Test Cases |
Sample |
sample_01.txt, sample_02.txt |
All |
subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt |
Case Name |
Status |
Exec Time |
Memory |
sample_01.txt |
AC |
3 ms |
256 KB |
sample_02.txt |
AC |
3 ms |
256 KB |
subtask_1_01.txt |
AC |
9 ms |
256 KB |
subtask_1_02.txt |
AC |
3 ms |
256 KB |
subtask_1_03.txt |
AC |
9 ms |
256 KB |
subtask_1_04.txt |
AC |
4 ms |
256 KB |
subtask_1_05.txt |
AC |
3 ms |
256 KB |
subtask_1_06.txt |
AC |
3 ms |
256 KB |
subtask_1_07.txt |
AC |
7 ms |
256 KB |
subtask_1_08.txt |
AC |
3 ms |
256 KB |